javascript代码:
function initevent() {
var pic = document.getElementById("pic");
if (!pic) {
return;
}
document.onmousemove = function () {
pic.style.display = "";
pic.style.top = window.event.clientY;
pic.style.left = window.event.clientX;
};
document.onmouseout = function () {
pic.style.display = "none";
};
}
网页内容:
<body οnlοad="initevent()">
<div id="pic" style="position:absolute;display:none;"><img src="pvfhv.jpg" /></div>
</body>