PDA

View Full Version : onMouseOver


DDL
03-09-2006, 04:42 PM
I was wondering: does the IMG tag support something similar to the onMouseOver effect you can assign to text links? Here is what I have..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div id="text" style="position:absolute; left:341px; top:167px; width:169px; height:103px; z-index:1; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000;"></div>
<img src="can_blue.gif" onMouseOver="MM_setTextOfLayer('text','','Various text.')" />
</body>
</html>


If I were doing that right, that should have worked...but it didn't. Could someone tell me what I am doing wrong, or if the IMG tag doesn't support it, could someone tell me what I could do to get the same effect? Thanks!!

Mr J
03-09-2006, 05:06 PM
Do you mean something like this?

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>

<script type="text/javascript">

function showHide(str){
document.getElementById("display").innerHTML=str
}

</script>
</HEAD>
<BODY>

<div id="display" style="position:absolute; left:341px; top:167px; width:169px; height:103px; z-index:1; background-color: #FFFFFF; border:1px solid #000000"></div>
<img src="can_blue.gif" onmouseover="showHide('Various text.')" /><BR>
<img src="can_blue.gif" onmouseover="showHide('Another variety of text.')" />

</BODY>
</HTML>

mortalgod
03-09-2006, 05:21 PM
this should work

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div id="text" style="position:absolute; left:341px; top:167px; width:169px; height:103px; z-index:1; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000;"></div>
<img src="can_blue.gif" onmouseover="MM_setTextOfLayer('text','','Various text.')" />
</body>
</html>

onmouseover has no caps in it

DDL
03-09-2006, 08:03 PM
Thanks Mr. J, the code worked great. :)

DDL
03-09-2006, 08:04 PM
this should work

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div id="text" style="position:absolute; left:341px; top:167px; width:169px; height:103px; z-index:1; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000;"></div>
<img src="can_blue.gif" onmouseover="MM_setTextOfLayer('text','','Various text.')" />
</body>
</html>

onmouseover has no caps in it

Actually, the case doesn't really matter, unless you are defining a variable.