刚学 js,求问大家这种情况下怎么改,获取鼠标移动数据的 js 在父页面,但是想要获取鼠标在 iframe 内的移动数据,设置了 timeout 还是获取不到?应该怎么改呢?
<body onload="alertNum();browerInfo()" onkeydown="keyDown()" onkeyup="keyUp()" onmousedown="mousedown_sendXML()" onmousemove="mousemove_sendXML()" onmouseup="mouseup_sendXML()">
<iframe name="wenjuan" id="wenjuan" frameborder="0" height="1200" width="1600" z-index=100 src="https://wj.qq.com/s2/2885356/2b08/" frameborder="0" allowfullscreen></iframe>
function mousemove_sendXML(){
var d = (new Date()).valueOf();
var iframe = document.getElementById("wenjuan");
//var iwindow = iframe.contentWindow;
var e = window.event || arguments.callee.caller.arguments[0] || iwindow.event;
var x = e.screenX ;
var y = e.screenY ;
StringData=StringData+"miaosha1"+" "+"mousemove"+" "+x+" "+y+" "+d+"\n";
document.getElementById("StrData").value = StringData;
var clientX=e.clientX;
var clientY=e.clientY;
strCilent=strCilent+"miaosha1"+" "+"mousemove"+" "+clientX+" "+clientY+" "+d+"\n";
document.getElementById("StrData2").value = strCilent;
setTimeout(getdata,1000);
function getdata() {
var cX=e.screenX;
var cY=e.screenY;
strData3=strData3+"miaosha1"+" "+"mousemove"+" "+cX+" "+cY+" "+d+"\n";
document.getElementById("StrData3").value = strData3;
}}
--
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.