`
5211422
  • 浏览: 209123 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

js

阅读更多

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>test.html</title>
 
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
 <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
 <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">

    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
  <script type="text/javascript">
  var i=0;
  var num=0;
   function test(){
    i=i+1;
    document.all.a.innerHTML=""+i;
    
    var now=new Date();
    
    document.all.study.innerHTML=now.getTime()+"=="+now.toString()+"=="+now.valueOf();

    document.getElementById("viewDoc").innerHTML=""+document.title+"=="+document.URL;
    //document.write("bbbbbbbb"+i);

    num=window.setTimeout(test,1000);//循环
     //window.setInterval()//延后
   }
  function stop333(){
   window.clearTimeout(num);
   alert("循环stop");
  }
  function keyMe(e){
   var viewStr = String.fromCharCode(e.keyCode);
   var press = e.altKey;//alt健是否按下
   //event.metaKey=true|false|1|0 meta健是否按下
   //event.ctrlKey=true|false|1|0 ctrl健是否按下
   //event.button=0|1|2为鼠标 左、中、右按键
   //event.shiftKey=true|false|1|0 shift是否被按下
   document.all.evenVieddddddddddw.innerHTML=viewStr+"是否按下alt:"+press;
  }
  </script>
  </head>
 
  <body onload="test();">
  <div id="a"></div>
  时间:<div id="study">aaaaaaaaaaaaaa</div>
  document 文档名/URL:<div id="viewDoc">bbbbbbbb</div>
  <a onclick="stop333();">停止timeout</a><br/>
   <input id="evenView" value="键盘事件event" onkeydown="keyMe(event);"><span id="evenVieddddddddddw">CCCCCCCCCCCC</span>
  </body>
</html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics