Tooltip 显示大图的代码(show an enlarge image in the tooltip of the image)

 

Hi friend

try to use the following code, I think this is the best solution, easy and coolCool

Hope this helps

<html> 
<head>
<title>Lance</title> 
<script language="javascript"> 
function showPic(sUrl)

 
var x,y; 
 x 
= event.clientX; 
 y 
= event.clientY; 
 document.getElementById(
"Layer1").style.left = x; 
 document.getElementById(
"Layer1").style.top = y; 
 document.getElementById(
"Layer1").innerHTML = "<img height=200 width=400 src=\"" + sUrl + "\">"
 document.getElementById(
"Layer1").style.display = "block"
}
 
function hiddenPic()
 document.getElementById(
"Layer1").innerHTML = ""
 document.getElementById(
"Layer1").style.display = "none"
}
 
</script>
</head>
<body>
<div id="Layer1" style="display:none;position:absolute;z-index:1;"></div> 
<img src="http://forums.asp.net/Themes/FAN/style/i/logo.png" onmouseout="hiddenPic();" onmousemove="showPic(this.src);"/> 
<p></p> 
</body> 
</html> 

posted @ 2008-05-27 11:10  LanceZhang  阅读(1298)  评论(1)    收藏  举报