PDA

View Full Version : onMouseOver keeps running in NN


Frank
05-21-2003, 03:27 PM
The problem that I having is that I think that the onMouseOver keeps calling its function. Heres my code.

<script>
function text(){
var div = document.getElementById("Home");
div.style.visibility= "visible";
}

function notext(){
var div = document.getElementById("Home");
div.style.visibility= "hidden";
}
//-->
</script>

<body>
<a href="homepage.htm" target="bottom" onMouseOut=" notext()" onMouseOver="text()"> <img border="0" src="images/home_button.gif" width="60" height="20"></a>



<div id="Home" style="position: absolute; left: 563px; top: 75px; height: 175px; width: 121px; visibility: hidden; filter:alpha(opacity=75); -moz-opacity: 75%; background-color: transparent">
<table cellSpacing="0" cellPadding="3" width="121" border="0">
<tr>
<td><span class="menutext">Takes you to my homepage.</span></td></tr></table></div>
</body>

I would like it to work in both IE and NN, right now it only works in IE. In NN7 the div flickers as you move the mouse over the image which it shouldn't.

Thanks for any help

Roy Sinclair
05-21-2003, 04:28 PM
Rename the "text" function to something else, you've got a clash with a reserved word.

Frank
05-21-2003, 04:57 PM
Ok, I did that.

If didn't make any difference that I could see.:(

Roy Sinclair
05-21-2003, 06:58 PM
What does the code look like now?

Hint: Turn on the javascript debugger in NN7, it'll help you find problems quicker.

Frank
05-21-2003, 09:10 PM
Here is the code the way it appears now.

<script>
function seetext(){
var div = document.getElementById("Home");
div.style.visibility= "visible";
}

function noseetext(){
var div = document.getElementById("Home");
div.style.visibility= "hidden";
}
//-->
</script>

<body>
<a href="homepage.htm" target="bottom" onMouseOut=" notseeext()" onMouseOver="seetext()"> <img border="0" src="images/home_button.gif" width="60" height="20"></a>



<div id="Home" style="position: absolute; left: 563px; top: 75px; height: 175px; width: 121px; visibility: hidden; filter:alpha(opacity=75); -moz-opacity: 75%; background-color: transparent">
<table cellSpacing="0" cellPadding="3" width="121" border="0">
<tr>
<td><span class="menutext">Takes you to my homepage.</span></td></tr></table></div>
</body>

Roy Sinclair
05-21-2003, 09:37 PM
You've named one function noseetext but are calling notseetext, make sure the function names match.

RoyW
05-21-2003, 09:39 PM
I posted your code into a document,
changed
onMouseOut=" notseeext():"
to
onMouseOut=" noseetext()"

and it worked fine in IE5 and NS7.

Are you sure that is the exact code?
In your real page have you positioned the DIV over the image?

Frank
05-22-2003, 02:59 PM
Thanks for your help everyone.

It turn out that RoyW was right I did have the div height set way to high so it was over the image.

I changed the code so the div wasn't any bigger then it needed to be and it works great now.
What a simple mistake :o

Thanks again