setTimeout与setInterval
来源:互联网 发布:简易地图制作软件 编辑:程序博客网 时间:2024/06/05 03:50
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'windowOnLoad.jsp' starting page</title> <script type="text/javascript"> // reference: <[http://blog.csdn.net/zdwzzu2006/article/details/6047632]> // html dom setInterval()方法 // setInterval() 方法可以按照指定的周期(以毫秒计算来调用函数或计算表达式) // setInterval() 方法会不停地调用函数,知道clearInterval() 被调用或窗口被关闭, // 由setInterval()返回的ID值可以作为clearInterval() 方法的参数 // grammar: setInterval(code, millisec[, "lang"]); // 注意: setInterval() 的返回值,一个可以传递给window.clearInterval() 从而取消对code 的周期性执行的值; // setTimeout() 方法用于在指定的毫秒后调用函数或计算表达式 // grammar: <[setTimeout(code,millisec)]> window.onload = function(){ // setTimeout() var t=setTimeout("alert('5 seconds!')",5000); } </script> </head> <body> <input type="text" id="clock" size="35"> <script type="text/javascript"> var int = self.setInterval("clock()", 50); function clock() { // setInterval() clearInterval() var t = new Date(); document.getElementById("clock").value = t; } </script> <button onclick="int=window.clearInterval(int)">stop_interval</button> </body> <script type="text/javascript"> // 这样就可以通过js 代码直接定义这个方法,而不需要像这样定义了<body onload="javascript:a();"> // window.onload = function() { // var a = document.getElementById("loading"); // a.parentNode.removeChild(a); // } // onload方法为window对象的属性 if (window.onload == null) { var a = document.getElementById("loading"); window.onload = function(){a.style.display = 'none';} } else { eval("tempFunc =" +window.onload.toString()); window.onload = function(){tempFunc(); a.style.display = 'none';}; } </script></html>
0 0
- setTimeout与setInterval区别
- setTimeout()与setInterval()
- setTimeOut与 setInterval区别
- setTimeout与setInterval区别
- setTimeout与setInterval
- Window.setTimeout()与setInterval( )
- setTimeout与setInterval
- setTimeout与setInterval
- setInterval与setTimeout用法
- setInterval与setTimeout
- setTimeout与setInterval区别
- setInterval与setTimeout区别
- setTimeout与setInterval
- 【JavaScript】setTimeout与setInterval
- setInterval 与setTimeout
- setTimeout与setInterval区别
- setTimeout 与setInterval
- setInterval() 与setTimeOut区别
- Windows平台下sbt的安装设置
- php时间函数
- zsh命令提示符
- 高效开发Android App的10个建议
- sbt笔记三 用IDEA和Eclipse开发sbt项目
- setTimeout与setInterval
- 总结Cocos2d-x 3.x版本的一些变化
- oracle 怎么解锁scott账户
- Andriod三步学会安卓自定义视图及其属性
- 【Qt5开发及实例】36、单元性能测试
- Usingle apply, sapply, lapply in R
- 六角幻方
- Angry Grammar Nazi (水)
- 解决waiting for "Building workspace" to complete:project--->去掉build Automatically