这一段代码可以让页面产生十字标随鼠标移动
发表于:2007-06-30来源:作者:点击数:
标签:
style !-- #leftright, #topdown{ position:absolute; left:200; top:200; width:1px; height:1px; background-color:black; z-index:100; font-size:1px; } -- /style script language= Java Script !-- function followmouse1() { //move cross engine for
<style>
<!--
#leftright, #topdown {
position:absolute;
left:200;
top:200;
width:1px;
height:1px;
background-color:black;
z-index:100;
font-size:1px;
}
-->
</style>
<script language="
JavaScript">
<!--
function followmouse1()
{
//move cross engine for IE 4+
leftright.style.pixelTop=document.body.scrollTop+event.clientY+20
topdown.style.pixelTop=document.body.scrollTop+20
if (event.clientX<document.body.clientWidth-20)
topdown.style.pixelLeft=document.body.scrollLeft+event.clientX+20
else
topdown.style.pixelLeft=document.body.clientWidth-20
}
function followmouse2(e){
//move cross engine for NS 4+
document.leftright.top=e.y+1
document.topdown.top=pageYOffset
document.topdown.left=e.x+1
}
if (document.all)
document.onmousemove=followmouse1
else if (document.layers){
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=followmouse2
}
</script>
<div id="leftright" style="width:expression(document.body.clientWidth-200)"></div>
<div id="topdown" style="height:expression(document.body.clientHeight-200)"></div>
原文转自:http://www.ltesting.net