1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| <HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
if (navigator.appName == 'Netscape') {
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = netscapeMouseMove;
}
function netscapeMouseMove(e) {
if (e.screenX != document.getElementById('x').value && e.screenY != document.getElementById('y').value) {
document.getElementById('x').value = e.screenX;
document.getElementById('y').value = e.screenY;
}
}
function microsoftMouseMove() {
if (window.event.x != document.getElementById('x').value && window.event.y != document.getElementById('y').value) {
document.getElementById('x').value = window.event.x;
document.getElementById('y').value = window.event.y;
}
}
//--></SCRIPT>
</HEAD>
<BODY onmousemove="microsoftMouseMove()"> <!-- onmousedown="microsoftMouseMove()" onmouseup="microsoftMouseMove()" -->
<FORM NAME="test">
X: <INPUT TYPE="TEXT" NAME="x" id='x' SIZE="4"> Y: <INPUT TYPUE="TEXT" NAME="y" id='y' SIZE="4">
<input type="hidden" name="x" id='x'>
<input type="hidden" name="y" id='y'>
</FORM>
<script type="text/javascript">
function on(e){
m=document.getElementById("menu").style;
var mouseY =document.getElementById('x').value;
var mouseX =document.getElementById('y').value;
if(e){
if(e.which>1){
m.display="block";
m.top=mouseX+"px";
m.left=mouseY+"px"
return false;
}
else{
m.display="none";
};
}
else {
if(m.display=="block" && event.type=="click"){
m.display="none";
}
else if(event.type!="click"){
m.display="block"
m.top=mouseX+"px";
m.left=mouseY+"px"
};
return false
}
}
document.onclick=on;
document.oncontextmenu=on;
</script>
</BODY>
</HTML> |
Partager