Forum Moderators: open
What am I missing here?
~ ~ ~
I've got external js and css files that contain the following:
--------------------
function toggleMenu(currMenu){
if (document.getElementById) {
thisMenu = document.getElementById(currMenu).style
if (thisMenu.display == "block") {
thisMenu.display = "none" }
else {
thisMenu.display = "block" }
return false }
else {
return true } }
--------------------
.menu {display: none;
}
--------------------
And the code in the actual document:
--------------------
<a href="process.html" onMouseover="document.pro.src=prodark.src"
onMouseout="document.pro.src=prolight.src">
<img src=button/lpro.gif name=pro alt=Process></a><br>
<a href="testpage.html" onMouseover="document.gal.src=galdark.src"
onMouseout="document.gal.src=gallight.src"
onClick="return toggleMenu('menu1')"><img src=button/lgal.gif name=gal alt=Gallery></a>
<span class="menu" ID="menu1">
<a href="gallery1.html" onMouseover="document.one.src=onedark.src"
onMouseout="document.one.src=onelight.src">
<img src=button/l1.gif name=one alt="Gallery 1"></a><br>
<a href="gallery2.html" onMouseover="document.two.src=twodark.src"
onMouseout="document.two.src=twolight.src">
<img src=button/l2.gif name=two alt="Gallery 2"></a><br>
<a href="gallery3.html" onMouseover="document.three.src=threedark.src"
onMouseout="document.three.src=threelight.src">
<img src=button/l3.gif name=three alt="Gallery 3"></a></span>
What is the hidden div you mentioned?
Thanks for your help!
<body>
<div id="noSeeum">
<img src="myPhoto.jpg" />
</div>
</body>
From the code you supplied, I don't see where the .src values for the objects you are reassigning on mouseover and mouseout are originating. You're sure these images have been loaded as objects as in var myImgOne = new Image(); myImgOne.src = "theImageInQuestion.jpg";?
[edited by: Rambo_Tribble at 2:08 am (utc) on April 6, 2004]
I'm curious, you appear to have images with file extensions of .src. That's a bit odd. Why is that? .src is usually the way in dot notation to specify the source attribute of an image object.
Took the script straight out of the Visual Quickstart Guide for Javascript (Peachpit Press). Creating More Effective Rollovers: "[...] using the .src property, it fills the src properties of the two objects with the GIFS of [the two images]."
At the moment I'm on my Linux box, my Win XP is backing up. As soon as it's done I'll be able to get to my favorite editor (HTML-Kit) and try a few things. I think we'll want to try replacing some of the mouse event handler instructions with alert() functions to return the value of the objects we are looking for, to see if they are present.
I suspect it is the button/l1.gif in the menu1 span, since display:none will supress the loading of images. If you use the hidden div technique mentioned earlier to load button/l1.gif, the image will be available to display when menu1 is displayed.