我的代碼在Firefox中完美工作,但IE瀏覽器遇到問題。當我執行我得到錯誤,程序不能正確執行。描述說clientX爲空或不是對象。錯誤類型爲null或不是對象
var cursorLocation = new function(){
this.x = 0;
this.y = 0;
//This function is called onmousemove to update the stored position
this.update = function(e){
var w = window, b = document.body;
this.x = e.clientX + (w.scrollX || b.scrollLeft || b.parentNode.scrollLeft || 0);
this.y = e.clientY + (w.scrollY || b.scrollTop || b.parentNode.scrollTop || 0);
}} document.onmousemove=function(e){ cursorLocation.update(e); };
您當前的代碼將無法正常工作在所有... – Neal 2012-08-13 17:40:03