Hi guys,
I have the following code on my page :
[CODE]
<script language=”javascript” type=”text/javascript”>
<!– Begin
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSECLICK)
document.onclick = getMouseXY;
var tempX = 0;
var tempY = 0;
var continue1 = true;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else { // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}
tempX = tempX-130;
if (tempX <0){continue1 = false;}
if (tempX > 1000){continue1 = false;}
tempY = tempY-120;
if (tempY <0){continue1 = false;}
if (tempY > 1000){continue1 = false;}
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}
if(continue1 != false){
window.location=”./whichpixel.php?co=”+tempX+”,”+tempY;
}
}
// End –>
</script>
The script gets the x,y of the mouse and redirects to whichpixel.php onclick. the <0 >1000 is just because thats how big my image is (1000×1000).
The script works great, but when the user scrolls, the script only works for the current display, not the page as a whole. Any ideas ?