var id = 1;
function myClick(){
document.getElementById('c'+id).click();
id++;
if(id<5){
setTimeout(myClick(),5000)
}
}
function myClick(){
document.getElementById('c'+id).click();
id++;
if(id<5){
setTimeout(myClick(),5000)
}
}
解决方案 »
- 脚本截取一段字符串,提示 请实现properpies()
- Javascript 函数参数问题?
- 搜索引擎找不到相关内容的问题,来看看吧
- 复选框问题
- 在javascript如何实现点击一个按钮,既显示更多输入信息?
- 怎样将int 型的12转化成string 型的12 ????在线等
- 关于屏蔽ENTER键的问题
- meizz(梅花雨) 请进
- 我想在网页中键鼠标右键弹出自己的菜单,但不知道如何不让它显示IE自带的菜单?
- 一个页面两个frame:a1,a2.a1中有个iframe:if2。现要在if2中点击超链接,在a2中显示。怎么写javascript
- 请问,有人知道如果实现:一个IE只能打开一个子窗口?
- 求救:Please 给我一个解决方案
<!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> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="Gao YiXiang" />
<meta name="email" content="[email protected]" />
<meta name="keywords" content="javascript dhtml dom" />
<meta name="description" content="I love web development." />
</head>
<body><script type="text/javascript">
<!--
for (i=1; i<=7; i++)
{
document.write("<input id='c"+i+"' type='button' onclick=\"alert('Button C"+i+"\');\" value=C"+i+">\n");
}
//-->
</script><input type="button" value="ShowI" id="btnShow" /><script type="text/javascript">
<!--var iInterval = 5000;
var iEnd = 5;
var iCount = 0;
var iTimerID = null;
document.getElementById("btnShow").onclick = function()
{
iTimerID = setInterval(show, iInterval);
};function show()
{
iCount++;
document.getElementById('c'+iCount).click();
if (iCount == iEnd)
{
clearInterval(iTimerID);
}
}//-->
</script></body>
</html>
http://download.csdn.net/source/308913样式表中文手册
http://download.csdn.net/source/304124JScript语言参考
http://download.csdn.net/source/308916
function doit() {
document.getElementById('c1').click();
var Process = setInterval(function () {
document.getElementById('c'+count).click();
count++;
if (count>5) clearInterval(Process);
},5000);
}
for (i=1;i<=5;i++)
document.write("<input id=\"c"+i+"\" type=\"button\" onclick=\"alert(\'Button C"+i+"\');\" value=\"C"+i+"\"\/>\r\n"); document.write("<input type=\"button\" value=\"ShowI\" onclick=\"doit()\"\/>");</Script>
其实这段代码已经是低效率了
很简单的东西。你没找对思路。
以前只想到用setTimeout,执行一次之后要自己再加循环...
一直没想到用setInterval直接去循环,,太感谢了....我正在摸索那个打分方法~~~~谁能告诉我一下悬赏的分是咋样打出去的.....-____-!!
小弟是在太菜了...不好意思....