Jump to content

Problem with Rollover Script


Mr.x

Recommended Posts

Good Evening Everyone,

Below is posted a script that I found on an online tutorial. I need to create a menu bar where when you rollover text a css layer appears and STAYS visible UNTIL your roll over another. The script allows them to become visible, but doesn't make the previous one disabled ie. I mouseover img1, txt 1 appears. I roll over img 2.. txt 2 appears and txt 1 should Dissapear.

Thanks in advance,
Sean

[code]
<style>
div.hidden_layer {
display: none;
speak: none;
}
div.visible_layer {
display: block;
speak: normal;
}
</style>

<script>
function doHoverText(sID) {
// sID is the ID of the layer we want to show.
// If no ID given, bail out:
if (!sID) return;
// Get a reference to the actuall layer:
var oLayer = (document.getElementById(sID)) ? document.getElementById(sID) : 'undefined';
// But bail out if the layer was not found:
if (!oLayer || oLayer=='undefined') return;
// Then show the layer we want:
oLayer.className = "visible_layer";
}

function doMouseOver(oImg, sID) {
doHoverText(sID);
doHoverImage(oImg);
}

</script>
</head>
<body>
<img src="image1.gif" onMouseOver="doMouseOver(this, 'changing_layer_1')">
<img src="image2.gif" onMouseOver="doMouseOver(this, 'changing_layer_2')">
<img src="image3.gif" onMouseOver="doMouseOver(this, 'changing_layer_3')">
... blah blah...
<div id="changing_layer_1" class="hidden_layer">Layer 1 ... blah blah...</div>
<div id="changing_layer_2" class="hidden_layer">Layer 2 ... blah blah...</div>
<div id="changing_layer_3" class="hidden_layer">Layer 3 ... blah blah...</div>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.