<HTML>
<BODY>
<center>
<br><br>
<form name="Disp">
<table border=2 cellpadding=6>
<tr>
<td colspan=2 bgcolor=blue align=center>
<font color=white><b>マウスの座標</b></td>
</tr>
<tr>
<td bgcolor=#ffffe8 align=center>
<b>X座標 <input type="text" name="Mouse_posX" value="0" size="4">
</td>
<td bgcolor=#ffffe8 align=center>
<b>Y座標 <input type="text" name="Mouse_posY" value="0" size="4">
</td>
</tr>
<td colspan=2 align=center>
<font color=blue size=2>マウスを動かしてみてください。</font>
</td>
</tr>
</table>
</form>
<script language="JavaScript">
<!--
var IEs = document.all?true:false;
if (!IEs) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = mouse_position;
var temp_Xpos = 0;
var temp_Ypos = 0;
function mouse_position(_val) {
if (IEs) { // Internet Explorer
temp_Xpos = event.clientX + document.body.scrollLeft;
temp_Ypos = event.clientY + document.body.scrollTop;
} else { // NetScape
temp_Xpos = _val.pageX;
temp_Ypos = _val.pageY;
}
if (temp_Xpos < 0) temp_Xpos = 0;
if (temp_Ypos < 0) temp_Ypos = 0;
document.Disp.Mouse_posX.value = temp_Xpos;
document.Disp.Mouse_posY.value = temp_Ypos;
return true;
}
//-->
</script>
</BODY>
</HTML>
|