Hey guys i have the following script which gives me cursor position when i move the mouse . this script works fine in chrome,FF and even in IE 8(without !doctype html)
if add !DOCTYPE html to the html page. it gives me object doesnt support this property error. and the below given line is causing the problem
document.captureEvents(Event.MOUSEMOVE);
How can i fix this problem with !DOCTYPE html included in IE 8.
window.onload = init;
function init() {
if (window.Event) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = getCursorXY;
}
function getCursorXY(e) {
document.getElementById('cursorX').value = (window.Event) ? e.pageX :
event.clientX + (document.documentElement.scrollLeft ?
document.documentElement.scrollLeft : document.body.scrollLeft);
document.getElementById('cursorY').value = (window.Event) ? e.pageY : event.clientY
+ (document.documentElement.scrollTop ? document.documentElement.scrollTop :
document.body.scrollTop);
}