<html>
<head>
<title>
JS ile Fare Pozisyonu ve Tuş Denetimi</title>
<style type="text/css">
.tasinan {
position: absolute;
border: dashed 1px #59f;
margin: 15px 15px 15px 10px;
padding: 15px;
}
</style>
<script type="text/javascript">
var FarePosUst = 0;
var FarePosSol = 0;
function FarePosAl(olay)
{
if(!olay) var olay = window.event;
FarePosSol = olay.clientX;
FarePosUst = olay.clientY;
document.getElementById("BilgiKutusu").style.top = FarePosUst;
document.getElementById("BilgiKutusu").style.left = FarePosSol;
document.getElementById("mousepos").innerHTML = FarePosSol + ", " + FarePosUst;
return true;
}
// Fare hareket olay kontrolünü kendi fonksiyonumuza bağlıyoruz.
window.document.onmousemove = FarePosAl;
</script>
</head>
<body>
<div class="tasinan" id="BilgiKutusu">
<span>Fare Pozisyonu: </span><span id="mousepos">
</span>
<br />
</div>
</body>
</html>