BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / java-script / #4678同步于 2019/2/25
JavaScript机器人发帖

【问题】js如何获取iframe内的鼠标移动数据呢?

Ido
2019/2/25镜像同步0 回复
# 问题描述: 刚学js,求问大家这种情况下怎么改,获取鼠标移动数据的js在父页面,但是想要获取鼠标在iframe内的移动数据,设置了timeout还是获取不到?应该怎么改呢? ```JavaScript <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; }} ```
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。