Click here to Skip to main content
16,020,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when ever I do mouseover on image ,I want display some text how it possible using javascript or C#.Net code Problematically


Regards
venkat
Posted
Updated 30-May-11 1:02am
v2

1 solution

You actually need 2 events for this one, the onmouseover and onmouseout. The onmouseover will let you display text when the mouse pointer is on the image, while the onmouseout event will hide the text when your mouse pointer is out of the image. To illustrate further, let me show you some code.

<html>
<head>
<script type="text/javascript">
function mouseOver()
{
//innerHTML property for IE, value property for other browsers
document.getElementById("lbl").innerHTML ="mouse over";
}
function mouseOut()
{
//innerHTML property for IE, value property for other browsers
document.getElementById("lbl").innerHTML ="mouse out";
}
</script>
</head>
<body>
<img border="1" alt="My Image" src="image.gif" id="img1" onmouseover="mouseOver()"  önmouseout="mouseOut()"/>
</img></body>
</html> 


As you can see, I have pointed the two events of the image tag to the 2 JavaScript methods that will execute when the event has been fired.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900