[thelist] Simple JavaScript not working in Mozilla
shortestpath
shortestpath at yahoo.com
Thu Sep 4 22:05:32 CDT 2003
from the way you're using element.className, the function
classChange expect element to be an element (or reference
to an element).
But classChange(caption,'visible') doesn't mean you are
actually doing that. What you need is:
classChange(document.getElementById('caption'),'visible')
Likewise in the onmouseout.
-alex
--- Andy Warwick <mailing.lists at creed.co.uk> wrote:
Hi
I'm trying to set up a really simple rollover reveal of a div, using
the following code:
<div id="caption" class="hidden">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elitt.</p>
</div>
<p id="caption-reveal" onmouseover="classChange(caption,'visible')"
onmouseout="classChange(caption,'hidden')">
Rollover
</p>
<script type="text/javascript">
function classChange( element, newclass )
{
element.className = newclass ;
}
</script>
<style type="text/css">
.hidden { visibility: hidden; }
.visible { visibility: visible; }
</style>
Works fine in IE (Mac and PC), Safari, but fails in Mozilla and related
browsers.
I must be missing something *really* obvious, but I can't see what...
All help gratefully received.
--
Andy Warwick
Creed New Media Design
w: http://www.creed.co.uk
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the thelist
mailing list