js鼠标悬停显示文字的实例介绍?
如<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
1、<html>
2、<head>
3、<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
4、<title>JS教程:鼠标悬停时显示文字或显示图片</title>
5、<script language="javascript">
6、functionshowPic(sUrl{varx,y;x=event.clientX;y=event.clientY;document.getElementById("Layer1").style.left=x;document.getElementById("Layer1").style.top=y;document.getElementById("Layer1").innerHTML = "<img src=\"" + sUrl + "\">"; document.g
7、function hiddenPic(){ document.getElementById("Layer1").innerHTML = ""; document.getElementById("Layer1").style.display = "none"; }
8、</script>
9、</head>
10、<body>
11、<div id="Layer1" style="display:none;position:absolute;z-index:1;"></div>
12、<img src="#########" onmouseout="hiddenPic();"
13、onmousemove="showPic(this.src);" title="wowowowo" /> //此行title实现悬停时显示文字onmousemove实现显示图片
14、<p></p>
15、</body>
16、</html>