Re: Handle events from central script
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Handle events from central script

From: Michael Winter <m.winter@blueyonder.co.invalid>
Date: Thu Jun 23 2005 - 15:55:53 CEST

On 23/06/2005 14:24, Markus Ernst wrote:

[snip]

> if (document.getElementsByTagName) {
> a = document.getElementsByTagName("a");
> for (var i=1; i<a.length; i++) {
> var element = a[i];
> element.onmouseover = function() { element.parentNode.className =
> "aktiv"; };
> element.onMouseOut = function() { element.parentNode.className =
> "passiv"; };
> element.onFocus = function() { element.parentNode.className =
> "aktiv"; };
> element.onBlur = function() { element.parentNode.className =
> "passiv"; };
> }
> }

The problem is that you're forgetting about case-sensitivity: for
instance, there is no recognised onMouseOut property, but there is a
generally recognised onmouseout property. The same goes for onFocus and
onBlur.

However, you don't need a script to do what you're attempting. CSS is
quite capable:

   a:link {
     /* Declarations used by the .passiv class */
   }
   a:focus,
   a:hover {
     /* Declarations used by the .aktiv class */
   }

Note: IE doesn't support the :focus pseudo-class, though others do.

[snip]

Mike

-- 
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Received on Tue Oct 18 02:47:53 2005