刚学 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;
}}
--