javascript pro
wholesale products drop shippers list www.webmastersprofitpak.net Web
Home  || Sitemap 

javascript proHome

Java Script Using Anchor Links and Event Handlers

  Anchor Links

This technique does not cause accessibility problems for assistive technology. A more difficult problem occurs when developers use images inside of JavaScript URL's without providing meaningful information about the image or the effect of the anchor link. For instance, the following link alsoinvokes the JavaScript function myFunction, but requires the user to click on an image instead of the text "Start myFunction":

 

This type of link, as written, presents tremendous accessibility problems, but those problems can easily be remedied. The image tag, of course, supports the "alt" attribute that can also be used to describe the image and the effect of clicking on the link. Thus, the following revision remedies the accessibility problems created in the previous example:

 

Another technique advocated by some developers is to use the "title" attribute of the tag. For instance, the following example includes a meaningful description in a "title" attribute:

 

This tag is supported by some but not all assistive technologies. Therefore, while it is part of the HTML 4.0 specifications, authors should use the "alt" tag in the enclosed image.

Finally, the browser's status line (at the bottom of the screen) typically displays the URL of any links that the mouse is currently pointing towards. For instance, if clicking on an anchor link will send the user to http://www.usdoj.gov, that URL will be displayed in the status line if the user's mouse lingers on top of the anchor link. In the case of JavaScript URL's, the status line can become filled with meaningless snips of script. To prevent this effect, some web developers use special "event handlers" such as onmouseover and onmouseout to overwrite the contents of the status line with a custom message. For instance, the following link will replace the content in the status line with a custom message "Nice Choice".

 

This text rewritten into the status line is difficult or impossible to detect with a screen reader. Although rewriting the status line did not interfere with the accessibility or inaccessibility of the JavaScript URL, web developers should ensure that all important information conveyed in the status line also be provided through the "alt" attribute, as described above.

Event Handlers

JavaScript uses so-called "event handlers" as a trigger for certain actions or functions to occur. For instance, a web developer may embed a JavaScript function in a web page that automatically checks the content of a form for completeness or accuracy. An event handler associated with a "submit" button can be used to trigger the function before the form is actually submitted to the server for processing. The advantage for the government agency is that it saves government resources by not requiring the government's server to do the initial checking. The advantage for the computer user is that feedback about errors is almost instantaneous because the user is told about the error before the information is even submitted over the Internet.

Web developers must exercise some caution when deciding which event handlers to use in their web pages, because different screen readers provide different degrees of support for different event handlers. The following table includes recommendations for using many of the more popular event handlers:

onClick The onClick event handler is triggered when the user clicks once on a particular item. It is commonly used on links and button elements and, used in connection with these elements, it works well with screen readers. If clicking on the element associated with the onClick event handler triggers a function or performs some other action, developers should ensure that the context makes that fact clear to all users. Do not use the onClick event handlers for form elements that include several options (e.g. select lists, radio buttons, checkboxes) unless absolutely necessary.

onDblClick The onDblClick event handler is set off when the user clicks twice rapidly on the same element. In addition to the accessibility problems it creates, it is very confusing to users and should be avoided.

onMouseDown and onMouseUp The onMouseDown and onMouseUp event handlers each handle the two halves of clicking a mouse while over an element the process of (a) clicking down on the mouse button and (b) then releasing the mouse button. Like onDblClick, this tag should be used sparingly, if at all, by web developers because it is quite confusing. In most cases, developers should opt for the onClick event handler instead of onMouseDown.

onMouseOver and onMouseOut These two event handlers are very popular on many web sites. For instance, so-called rollover gif's, which swap images on a web page when the mouse passes over an image, typically use both of these event handlers. These event handlers neither can be accessed by the mouse nor interfere with accessibility a screen reader simply bypasses them entirely. Accordingly, web designers who use these event handlers should be careful to duplicate the information (if any) provided by these event handlers through other means.

onLoad and onUnload Both of these event handlers are used frequently to perform certain functions when a web page has either completed loading or when it unloads. Because neither event handler is triggered by any user interaction with an element on the page, they do not present accessibility problems.

onChange This event handler is very commonly used for triggering JavaScript functions based on a selection from within a select tag. Surprisingly, it presents tremendous accessibility problems for many commonly used screen readers and should be avoided. Instead, web developers should use the onClick event handler (associated with a link or button that is adjacent to a select tag) to accomplish the same functions. onBlur and onFocus These event handlers are not commonly used in web pages. While they don't necessarily present accessibility problems, their behavior is confusing enough to a web page visitor that they should be avoided.

This article is translated to Serbo-Croatian language by Jovana Milutinovich from Webhostinggeeks.com.

javascript pro software Java Script Pro is a revolutionary software that will turn you into a PRO webmaster overnight! 15 different website scripts are built into the software. All you have to do is push a couple buttons and the customized code will be rendered. More JavaScript Pro

 



Start an Online Business for $19.95 . Sell software downloads- 50 programs. Each comes with sales website. Make one sale and recoup total investment. Sell three per day and earn $2,000/month.

Web Hosting from $5/month.

Free Statistics,
Dependable,
Chilisoft ASP,
RVSkin,
Fantastico,
Unlimited MySQL's,
Unlimited Sub Domains,
Unlimited Email Accounts,
Unlimited Mailing Lists,
Unlimited FTP Accounts,
Active Support System.

<

Copyright 2005 webmastersprofitpak.net. All rights reserved.