Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Onmouseover connected to text

Status
Not open for further replies.

MinalMoe

IS-IT--Management
Mar 25, 2004
62
GB
Is there any way that if I have an HREF link with text only and NO IMAGE, that when the text is rolled over, an image appears?

Many thanks.
 
Where is the image to appear? Do you want the image to appear and replace the text?

Try this
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
	function shwImage(it) {
	  document.getElementById(it).innerHTML='<img src="images/arrows.gif" alt="" />';
	}
	function shwText(it,txt) {
	  document.getElementById(it).innerHTML=txt;
	}
</script>
</head>

<body>
<a href="#"><span id="linkID" onmouseover="shwImage('linkID');" onmouseout="shwText('linkID','Why move your mouse?');">Here is some text!</span></a>
</body>
</html>

You will notice that as you mouse over the events are caught in a loop even if you keep you pointer in place. If you remove the onmouseout event, you should get the effect you asked for.

Hope this helps!


--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top