아래스크립트를 해더아래에 붙이시면 언제든지 좌표값을 출력하여 보여줄수있게됩니다.
웹디자인을 할때 테이블어떤부분이 몇픽셀차이가 나는지 마춰볼수있겠죠 ^^
<html>
<head>
<title>해피CGI</title>
//--해더아래불여지는 자바스크립트--//
<script>
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Roy Marchand | http://www.expertsrt.com */
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>
//--해더아래불여지는 자바스크립트끝--//
</head>
<body>
//--바디아래 적용시키면되는 폼--//
<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>
|