[thelist] Simple JavaScript not working in Mozilla

Andy Warwick mailing.lists at creed.co.uk
Fri Sep 5 03:00:45 CDT 2003


On Friday, September 5, 2003, at 01:13 AM, Jeff Howden wrote:

> andy,
>
>> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>> From: Andy Warwick
>>
>> I'm trying to set up a really simple rollover reveal of
>> a div, using the following code:
>>
>
> mozilla doesn't automatically create top level variables for each id 
> found
> in the document, like ie and other browsers do.

Learn something new every day :)

> so, change the first
> argument in your classChange function calls to strings, and use the
> document.getElementById() method to access the object you wish to 
> change.
>
> <p id="caption-reveal"
>    onmouseover="classChange('caption', 'visible')"
>    onmouseout="classChange('caption', 'hidden')"
>> Rollover</p>
>
> <script type="text/javascript">
>   function classChange( id, newclass )
>   {
>     element = document.getElementById(id);
>     if(element)
>       element.className = newclass ;
>   }
> </script>

Jeff

That sorts it; thx a lot.

-- 
Andy Warwick
Creed New Media Design
w: http://www.creed.co.uk



More information about the thelist mailing list