473,772 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LinkButton and JavaScript accessability

Hi

I have noticed that the LinkButton creates a hyperklink to a javascript
location .e.g.
<a href="javascrip t:__dopostback"

This is bad for accessability because browsers without Javascript won't be
able to follow the links.
Where possible I have used normal links that change the query string of the
page, however some things, such as submitting forms are impossible.

So, my question is - is there a way (I'm sure there is, just not sure how)
of changing LinkButtons to standard buttons if javascipt is disabled?
I know that ASP.NET does make changes based on whether or not the client has
JavaScript support.
Both the Button and LinkButton implement IButtonControl, which have the
click event and text property.
This would idealy be s site wide solution, and would allow me to use
LinkButtons (which look a lot nicer than buttons) for most users, but if the
client doesn't support Javascript then normal Buttons would be displayed.

Thanks to anyone who may be able to help,

Marc

Aug 19 '08 #1
2 1994
I don't think you can detect on server side if javascript is disabled in
browser security settings. You can detect if the browsers supports
javascript or not (Request.Browse r.JavaScript), but it is next to useless.

There are too many things in asp.net to worry about if you want to provide
for disabled javascript.

According to http://www.w3schools.com/browsers/browsers_stats.asp only 5% of
users have javascript disabled. And they are unlikely to use any serious
interactivity.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Marc Wickens" <Marc Wi*****@discuss ions.microsoft. comwrote in message
news:93******** *************** ***********@mic rosoft.com...
Hi

I have noticed that the LinkButton creates a hyperklink to a javascript
location .e.g.
<a href="javascrip t:__dopostback"

This is bad for accessability because browsers without Javascript won't
be
able to follow the links.
Where possible I have used normal links that change the query string of
the
page, however some things, such as submitting forms are impossible.

So, my question is - is there a way (I'm sure there is, just not sure how)
of changing LinkButtons to standard buttons if javascipt is disabled?
I know that ASP.NET does make changes based on whether or not the client
has
JavaScript support.
Both the Button and LinkButton implement IButtonControl, which have the
click event and text property.
This would idealy be s site wide solution, and would allow me to use
LinkButtons (which look a lot nicer than buttons) for most users, but if
the
client doesn't support Javascript then normal Buttons would be displayed.

Thanks to anyone who may be able to help,

Marc

Aug 19 '08 #2
"Marc Wickens" <Marc Wi*****@discuss ions.microsoft. comwrote in message
news:93******** *************** ***********@mic rosoft.com...
Hi

I have noticed that the LinkButton creates a hyperklink to a javascript
location .e.g.
<a href="javascrip t:__dopostback"

This is bad for accessability because browsers without Javascript won't
be
able to follow the links.
Where possible I have used normal links that change the query string of
the
page, however some things, such as submitting forms are impossible.

So, my question is - is there a way (I'm sure there is, just not sure how)
of changing LinkButtons to standard buttons if javascipt is disabled?
I know that ASP.NET does make changes based on whether or not the client
has
JavaScript support.
Both the Button and LinkButton implement IButtonControl, which have the
click event and text property.
This would idealy be s site wide solution, and would allow me to use
LinkButtons (which look a lot nicer than buttons) for most users, but if
the
client doesn't support Javascript then normal Buttons would be displayed.

Thanks to anyone who may be able to help,

Marc
You can only submit form with <input type="Submit".. .or <input
type="image"wit h Javascript..
If you do not want to use Javascript use regular buttons... <asp:Button.. .>
Or you can use ImageButton.. I think it does not generate javascript too..

George
Aug 19 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3749
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the following code fragments in which I want to list through all files on a directory with a link to download each file by passing a filename and whether or not to force the download dialog box to appear.
1
5326
by: Nevyn Twyll | last post by:
I have a DataList; in the DataList's , I have a LinkButton and a few listboxes. When the LinkButton is pressed, I need to get the ID of the selected item in one of the Listbox controls. Then I want to launch another web page in a seperate window, using that ID. In the header of the web page, I have a javascript function LaunchMyWindow(iID) that launches that window. For a normal LinkButton Control, I could just use
6
9074
by: Al Cohen | last post by:
I'm using a LinkButton to call some code, then do a redirect. The code does some queries, sends some emails, and takes a few moments before the redirect is performed. I'd like to disable my LinkButton during this period to prevent multiple submissions. (Obviously) the disabling should be done at the client side to prevent any delay. I've tried adding some javascript to LinkButton.Attributes: LinkButton1.Attributes.Add("onclick",...
2
5595
by: Dave | last post by:
Hi, I have a datagrid with a Templated column below. I want to execute some javascript before the postback to show a hidden "div" tag with static message of "Please Wait..." since the query takes a few seconds. The js function simply sets the css style to display. <asp:TemplateColumn> <ItemTemplate> <asp:LinkButton Runat="server" CommandName="Select" ID="lbtnCompanyName"> <%# DataBinder.Eval(Container.DataItem, "CompanyName")%>...
6
4257
by: Shivakumar | last post by:
Hi all, Recently i have updated my vs.net 2003 project to vs.net 2005 and i have successfully converted my code and found no problem with all my controls except the one which is the linkbutton. I have added the linkbutton control in my datagrid and it rendered perfectly but whenever i clicked the linkbutton am getting this error 'event' is null or not an object.
0
1267
by: Oscar Thornell | last post by:
Hi, Problem: LinkButton control does not POST Environment: Win 20003, ASP.NET 2.0, XHTML Target/device: Symbian v.9/Opera 8.60 (168) based smartphones I am developing a mobile web application (VS.NET 2005/xhtml) the target device(s) are Symbian (v.9) based smartphones. We recently recived a new "batch" of test devices with upgraded software..
3
2773
by: Learner | last post by:
Hello, I have two buttons on one of my VehicleDetails.aspx page. Obiviously these two buttons takes the user to two different pages. Now my client is interested in having a linkbutton instead of the two buttons. Once the user clicks on the linkbutton a javascript dialog box popsup that says "Is the Lessee buying this vehicle?" and with two buttons "Yes" and "No". If user clicks "yes" it should go to DealerQuestions.aspx" and if "No" it...
3
7023
by: John | last post by:
Hi I have been trying to change the css class of a linkbutton without succes ( I dont want to change the cssclass property). Maybe somebody knowshow to do this?? th.John <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
3324
by: RN1 | last post by:
An ASPX page, named LinkButton.aspx, has a single LinkButton & nothing else. The code is very simple: <form runat="server"> <asp:LinkButton ID="lnk" PostBackUrl="Page1.aspx" Text="CLICK" runat="server"/> </form> When I run the above code in my local; (Intranet) IIS server, then when the LinkButton is clicked, the user is taken to Page1.aspx but
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.