首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

js获取鼠标点符号击坐标

2012-08-21 
js获取鼠标点击坐标//获取坐标位置function getPosition(ev){ev ev || window.eventvar point {x:0,y

js获取鼠标点击坐标

//获取坐标位置function getPosition(ev){ev = ev || window.event;var point = {x:0,y:0};    if(ev.pageX || ev.pageY){    point.x = ev.pageX;    point.y = ev.pageY;    } else {//兼容ie    point.x = ev.clientX + document.body.scrollLeft - document.body.clientLeft;    point.y = ev.clientY + document.documentElement.scrollTop;    }    return point;}
?

热点排行