使用iframe加载HTML HTML

时间:2018-09-04 11:47:13

标签: javascript html iframe timeout

您好,到目前为止,这是我的hmtl和JS,我希望它也可以检测iframe窗口中的mousemove,scroll和箭头,因为大多数网站都位于iframe中,所以我在其他地方查找了所有东西,而且看起来似乎都过分了检测运动很复杂。

任何帮助将不胜感激 谢谢

<script type="text/javascript">
        // Set timeout variables.
        var timoutWarning = 1000; // Display warning in 1Mins.
        var timoutNow = 2000; // Timeout in 2 mins.

        var warningTimer;
        var timeoutTimer;

        // Start timers.
        function StartTimers() {
            warningTimer = setTimeout("IdleWarning()", timoutWarning);
            timeoutTimer = setTimeout("IdleTimeout()", timoutNow);
        }

        // Reset timers.
        function ResetTimers() {
            clearTimeout(warningTimer);
            clearTimeout(timeoutTimer);
            StartTimers();
            $("#timeout").dialog('close');
        }

        // Show idle timeout warning dialog.
        function IdleWarning() {
            var answer = confirm("Session About To Timeout\n\n       You will be automatically logged out.\n       Confirm to remain logged in.")
                if (answer){

                    ResetTimers();
                }
                else{
                    IdleTimeout();
                }
        }       

        // Logout the user and auto reload or use this window.open('http://www.YourPageAdress.com', '_self'); to auto load a page.
        function IdleTimeout() {
            window.open(self.location,'_top');
        }
    </script>

    <body onload="StartTimers();" onmousemove="ResetTimers();" onKeyPress="ResetTimers();"

1 个答案:

答案 0 :(得分:0)

类似*

$(".in").on("mouseover",function(){
   $(this).css("background","blue");
});
$(".in").on("mouseout",function(){
   $(this).css("background","green");
});
.in{width:50px;height:50px;background:red;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="in"></div>

  • 并使用多个$("selector").on("mouseover mouseout mousemove",function(){ call back });