- From: Charles F. Munat <charles@munat.com>
- Date: Tue, 25 Jan 2000 00:12:34 -0800
- To: "Patrick Burke" <burke@ucla.edu>, <w3c-wai-ig@w3.org>
Patrick wrote: "A week or two ago someone mentioned the importance of using ONFOCUS and ONBLUR events in Javascripts, e.g., to allow keyboard navigation. I think I have found a good example of this need, but if someone with more Javascript skills could verify what is going on I would be grateful. "The homepage for www.freediskspace.com has a number of links that are activated by Javascripts. Using JFW3.2 & IE4 I can navigate to the links, the URL is read, but hitting ENTER does nothing. The code appears to use only ONMOUSEOVER type functions." Patrick, What's going on here has nothing to do with onmouseover events. In fact, this is a classic example of trying to be too clever. What's actually happening here is that the coder wanted to validate the little form (the one that asks for your login name and password). He (or she) was afraid people might submit it without first entering their login name and password. So he/she wrote some code. Suppose you're in the login name box and you type your name and hit enter. It should submit the form, but in this instance, it moves the cursor to the password box. Similarly, if you enter a password without entering a name and hit the Enter key, it moves the cursor to the name box. Not a bad idea. The problem is this: to accomplish this the coder decided to capture all keyboard events. The code then looks at the event to see if it's a Enter key keypress. If so, it validates the form before submitting it. The problem is, it discards the Enter key keypress. So the Enter key is effectively useless for anything other than submitting the form. A clever idea, but poor testing. BTW, no-one, to my knowledge, triggers page loads with mouse-over events. Maybe if you had only one link on the page. But imagine a page that tripped the links when you slid the mouse over one of them! You'd have some very annoyed users. The problem isn't with coders using onmouseover and onmouseout instead of onfocus and onblur, it's with using onclick exclusively, instead of using it with onkeypress or a similar event handler. Oh, and the onmouseover events on the page are used only for typical image swaps to highlight the link images. Hope this helps. Give 'em hell. Sincerely, Charles F. Munat, Munat, Inc. Seattle, Washington
Received on Tuesday, 25 January 2000 03:13:21 UTC