六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 128|回复: 0

JS简易定时器

[复制链接]

升级  54%

35

主题

35

主题

35

主题

秀才

Rank: 2

积分
131
 楼主| 发表于 2013-2-7 20:12:23 | 显示全部楼层 |阅读模式
1、两个html文件,一个是定时程序,另一个在时间到时被打开。
2、MyHtml.html 定时器主程序,运行效果如下:

其中,文本框内输入多少秒后打开新页面。点 do 按钮开始计时。
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <title>MyHtml.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">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->  </head>    <body>    <form action="" name="form1">    <input type="text"  name="miao" style="width: 50px"><input type="button" value="do" >    </form>  </body>    <script type="text/javascript">  function doone()  {  window.open("show.htm");  }    function begin()  {  var num=form1.miao.value * 1000 ;    setTimeout("doone()",num)  }      </script></html>
3、show.htm 在时间点到时被打开,起到提醒作用
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <title>show.htm</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">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->  </head>    <body>    This time is shoud to get some ... <br>  </body></html>

程序见附件。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表