zoukankan      html  css  js  c++  java
  • 百度高度js 检测web页面是否正在操作,如超过规定时间内未操作将自动跳转至指定页面。

    每日一贴,今天的内容关键字为百度高度

        每日一道理
    那蝴蝶花依然花开花落,而我心中的蝴蝶早已化作雄鹰飞向了广阔的蓝天。
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <style type="text/css">
        
    html,body{height:100%; margin:0px; padding:0px;}
    #content
    {
    	/*DIV 高度100% */
    	height:auto!important; /*for ie6 bug and ie7+,moz,webkit 准确*/
    	height:100%; /*修复IE6,all browser*/
    	min-height:100%; /*for ie6 bug and ie7+,moz,webkit 准确*/
    }
    
    </style>
    <script type="text/javascript"> 
    
    var currentMousePosition1;//记载鼠标坐标
    var currentMousePosition2;
    var eventID;
    
    function mousePos(e){
    var x,y;
    var e = e||window.event;
    return {
    x:e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,
    y:e.clientY+document.body.scrollTop+document.documentElement.scrollTop
    };
    };
    
    function GetXYPosition(e){
    document.title = mousePos(e).x+','+mousePos(e).y;     //只做显示,实际使用可注释本行。
    currentMousePosition2 = document.title;
    };
    
    var timeout = 60*1000;  //设定超时时光
    var currentSecond = 0;
    
    function CheckTime()
    {
        if(currentMousePosition1 == currentMousePosition2)
        {
            currentSecond = currentSecond+1000;
            if(currentSecond>timeout)
            {
                clearInterval(eventID);
                alert("你已经超越1分钟没有操作,页面自动跳转至百度");
                window.location.href = "http://www.baidu.com";
            }
        }
        else
        {
            currentSecond = 0;
            currentMousePosition1 = currentMousePosition2;
        }
    }
    
    function StartPoint()
    {
       currentMousePosition1 = "";
       currentMousePosition2 = "";
       eventID = setInterval(CheckTime,1000);
    }
    
    </script>
    </head>
    <body onload="StartPoint()">
    <div id="content"  onmousemove="GetXYPosition(event)"></div>
    </body>
    </html>

    文章结束给大家分享下程序员的一些笑话语录: 警告
    有一个小伙子在一个办公大楼的门口抽着烟,一个妇女路过他身边,并对他 说, “你知道不知道这个东西会危害你的健康?我是说, 你有没有注意到香烟 盒上的那个警告(Warning)?”
    小伙子说,“没事儿,我是一个程序员”。
    那妇女说,“这又怎样?”
    程序员说,“我们从来不关心 Warning,只关心 Error”

  • 相关阅读:
    mysql 中 group_concat()用法
    MySQL行转列与列转行
    mysql中find_in_set()函数的使用(转载)
    多线程中的线程安全关键字
    架构师的特征
    算法复杂度的定义
    1.ArrayList和linkedList区别
    Plsql查询clob类型字段数据
    数据库的特性与隔离级别和spring事务的传播机制和隔离级别
    java中的线程
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3086124.html
Copyright © 2011-2022 走看看