First commit.
This commit is contained in:
43
subsites/projects/x/mousexy.htm
Normal file
43
subsites/projects/x/mousexy.htm
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>MouseXY</title>
|
||||
<style type='text/css'>
|
||||
#box {position:fixed;left:0; top:0; width:75px; height:75px; background-color:#09fc37}
|
||||
#mb {position:absolute; top:0; left:0; width:75px; height:75px; background-color:#09fc37}
|
||||
p {margin:3px}
|
||||
</style>
|
||||
<script type='text/javascript'>
|
||||
ie=document.all?true:false
|
||||
|
||||
function mc(e)
|
||||
{
|
||||
if (ie)
|
||||
{
|
||||
x=event.clientX+document.documentElement.scrollLeft
|
||||
y=event.clientY+document.documentElement.scrollTop
|
||||
}
|
||||
else
|
||||
{
|
||||
x=e.pageX
|
||||
y=e.pageY
|
||||
}
|
||||
if (x<0)
|
||||
x=0
|
||||
if (y<0)
|
||||
y=0
|
||||
|
||||
|
||||
document.getElementById("box").innerHTML="<p>x: "+x+"<br />y: "+y+"</p>"
|
||||
document.getElementById("mb").style.top=y-80+"px"
|
||||
document.getElementById("mb").style.left=x-2+"px"
|
||||
}
|
||||
|
||||
document.onmousemove=mc
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id='box'></div>
|
||||
<div id='mb'></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user