마우스 좌표 확인 (IE, 크롬, FF)
페이지 정보
작성자 서방님 댓글 0건 조회 189회 작성일 12-05-15 15:46본문
<script>
function showit() {
document.forms['theform'].xcoord.value=event.x;
document.getElementById('spanx').innerHTML='x = '+event.x;
document.forms.theform.ycoord.value=event.y;
document.getElementById('spany').innerHTML='y = '+event.y;
}
function showitMOZ(e) {
document.forms['theform'].xcoord.value=e.pageX;
document.getElementById('spanx').innerHTML='x = '+e.pageX;
document.getElementById('spany').innerHTML='y = '+e.pageY;
document.forms.theform.ycoord.value=e.pageY;
}
if (!document.all) {
window.captureEvents(Event.CLICK);
window.onclick=showitMOZ;
} else {
document.onclick=showit;
}
</script>
<h4>배경 아무곳이나 클릭하세요.</h4>
<form name="theform">
x = <input name="xcoord" type="text" readonly size="5">
y = <input name="ycoord" type="text" readonly size="5">
</form>
<p>
<span id="spanx"> </span> <span id="spany"> </span>
댓글목록
등록된 댓글이 없습니다.