iOS 开发实用技术导航
NSHipster 中文版
› http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
› http://www.cocos2d-iphone.org/
CocoaPods
› http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
› http://code.google.com/mobile/analytics/
WWDC
› https://developer.apple.com/wwdc/
Design Guides and Resources
› https://developer.apple.com/design/
Transcripts of WWDC sessions
› http://asciiwwdc.com
Cocoa with Love
› http://cocoawithlove.com/
Cocoa Dev Central
› http://cocoadevcentral.com/
NSHipster
› http://nshipster.com/
Style Guides
› Google Objective-C Style Guide
› NYTimes Objective-C Style Guide
Useful Tools and Services
› Charles Web Debugging Proxy
› Smore
lanoipd
V2EX  ›  iDev

[问题] js 如何获取在 iframe 内的鼠标移动数据呢?

  •  
  •   lanoipd · Feb 25, 2019 · 4496 views
    This topic created in 2768 days ago, the information mentioned may be changed or developed.

    问题描述:

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

    --

    1 replies  •  2019-02-26 13:26:27 +08:00
    leonlu
        1
    leonlu  
       Feb 26, 2019
    不同域名不行
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2651 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 03:30 · PVG 11:30 · LAX 20:30 · JFK 23:30
    ♥ Do have faith in what you're doing.