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

【新手求教】一个简单js参数有关问题

2012-10-13 
【新手求教】一个简单js参数问题JScript codedocument.onmousemove moveGuidesfunction moveGuides(e) {i

【新手求教】一个简单js参数问题

JScript code
document.onmousemove = moveGuides;function moveGuides(e) {    if (!guidesState) { return false; };    e = window.event ? window.event : e;    dollar("guidesYLine").style.left = browserIsIE ? (e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) + guidesSkew + "px" : e.pageX + guidesSkew + "px";    dollar("guidesXLine").style.top = browserIsIE ? (e.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) + guidesSkew + "px" : e.pageY + guidesSkew + "px";}

我的问题就是document.onmousemove = moveGuides这里调用moveGuides函数为什么不用传递参数啊???

moveGuides函数里面的参数 e 又是代表什么东西啊???有的时候执行的时候会告诉我说 e 未定义。。。。

[解决办法]
e是一个对象。
e = window.event ? window.event : e;//这条语句就看得出来了
你如果按照上面的方法使用。应该不会告诉你e未定义才对。顶多就是可能你在获取e的某些属性的时候,当前的对象不具备这个属性,倒是会
[解决办法]
事件写去iframe中。如果父窗口需要获取值,则iframe中传过来就是了

热点排行