e 是event 事件.x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX(document.layers) 只有在netscape 里才返回true.
所以
e.pageX 就是 netscape 里的真实X坐标值
而 event.clientX 就是IE里的X坐标值.
但注意:
clientX Property:
Sets or retrieves the x-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.同理得Y坐标
所以
e.pageX 就是 netscape 里的真实X坐标值
而 event.clientX 就是IE里的X坐标值.
但注意:
clientX Property:
Sets or retrieves the x-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.同理得Y坐标
这句话的意思是:
假如浏览器是NS的话,x = e.pageX
否则 x = document.body.scrollLeft+event.clientX
所以这是为了适应不同的浏览器而特意写的代码:function handlerMM(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
//x 应是事件发生时的鼠标在相对于页面(可能有滚动条)左边的x坐标,ie 和 netscape的计算方式不同
// layers是netscape的属性,// 否则就是IE
// 可以这么理解:x = e.pageX (如果是netscape)
document.body.scrollLeft + event.clientX (如果是IE)y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
flag=1
}
整个句子起什么呢?
谢谢!