setTimeout自动触发一个js。
2014-01-10 10:21
267 查看
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>timeout</title>
</head>
<body onload="countSecond()">
<input type="text" id="time" style="border:0px;" size="1px">
</body>
</html>
<script>
x = 0
function countSecond()
{ x = x+1
document.getElementById("time").value=x;
setTimeout("countSecond()", 1000)
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>timeout</title>
</head>
<body onload="countSecond()">
<input type="text" id="time" style="border:0px;" size="1px">
</body>
</html>
<script>
x = 0
function countSecond()
{ x = x+1
document.getElementById("time").value=x;
setTimeout("countSecond()", 1000)
}
</script>
相关文章推荐
- PhoneGap 00 写在前面的话
- js比较好的一些方法
- JSONP
- 深入理解JSON数据源格式
- js事件队列
- Web(css, javascript)
- Javascript疑问及实践
- jsp中页面间传汉字参数转码
- javascript遍历控件(实例详解)
- href="#"与href="javascript:void(0)"的区别
- javascript学习
- Raphael一个js编写的网页矢量图形库
- js获取光标位置和设置文本框光标位置
- Asp.net + JavaScript + Css 笔记
- jsp中页面间传汉字参数转码的方法
- ASP.NET JSON字符串与实体类的互转换示例代码
- 深入理解JSON数据源格式
- javascript通过className来获取元素的简单示例代码
- javascript使用百度地图api和html5特性获取浏览器位置
- JS实现根据出生年月计算年龄