54、状态栏显示鼠标坐标

54、状态栏显示鼠标坐标

脚本说明:

把如下代码加入<body>区域中

<script language="javascript">

 

var where = ""; // which link

function checkwhere(e) {

        if (document.layers){

        xCoord = e.x;

        yCoord = e.y;

}

        else if (document.all){

        xCoord = event.clientX;

        yCoord = event.clientY;

}

        else if (document.getElementById){

        xCoord = e.clientX;

        yCoord = e.clientY;

}

        self.status = "X座标值= "+ xCoord + "  Y座标值= " + yCoord +   " ---欢迎你的光临";

        }

 

 

document.onmousemove = checkwhere;

if(document.captureEvents) {document.captureEvents(Event.MOUSEMOVE);}

 

</script>

Write a comment

Comments: 0