求一个能自动定时提交JS的插件
[i=s] 本帖最后由 5653131 于 2009-11-11 02:06 编辑 [/i]就是在当前页面执行这个代码(比如 javascript:choose('1');)
效果如同在地址栏输入这段代码然后回车,有点像小孩子玩的qq空间那种代码的使用方法
实际上我是玩一些webgame,手动点太累了,为了偷懒……
看到有个能定时刷新的插件,但代码看起来一头雾水,各位能否帮帮忙修改下,谢谢
[code]
<script language="JavaScript">
var security_id=%max_security_id;
var intv = prompt('What is the time to Reload (in seconds):','60');
if(intv&&!isNaN(intv)){
var folder=external.m2_plugin_folder(security_id, "Continuous Reload");
var reload_button=folder+'\rreload_button.gif';
var close_button=folder+'\close_button.gif';
var ft='<html>\n';
ft+='<head><title>\n';
ft+=external.get_tab(security_id, external.cur_sel).document.title+'\n';
ft+='</title></head>\n';
ft+='<frameset rows=\'*,15\' framespacing=0 border=0 frameborder=no>\n';
ft+='<frame id=\'TargetFrame\' scrolling=auto noresize frameborder=no>\n';
ft+='<frame id=\'TimerFrame\' scrolling=no noresize frameborder=no>\n';
ft+='</frameset>\n';
ft+='</html>';
with(document){
write(ft);
frames['TargetFrame'].location.href=document.location.href;
var docstr='<html>\n';
docstr+='<body style=\'background-color: black; color: white; font-family: Verdana, Arial, Helvetica; font-size: 11px; font-weight: normal; margin-top:0px;\'>\n';
docstr+='<div align=\'center\' valign=\'middle\'><a href=\"javascript:reloadFrame()\" onmouseover=\"window.status=\'Reload the Page\'; return true\"><img align=\'middle\' alt=\'Reload the Page\' src=\''+reload_button+'\' height=\'11\' width=\'43\' border=\'0\'></a> Reloading in <span valign=\'middle\' id=\'caption\'></span> <a href=\"javascript:document.location=parent.frames[\'TargetFrame\'].location.href;\" target=\"_parent\" onmouseover=\"window.status=\'Close Continuous Reload\'; return true\"><img align=\'middle\' alt=\'Close Continuous Reload\' src=\''+close_button+'\' height=\'11\' width=\'11\' border=\'0\'></a> </div>\n';
docstr+='</body>\n';
docstr+='<script>\nvar reloadIntv='+intv+';\nvar secsLeft='+intv+';\nfunction reloadFrame(){secsLeft=reloadIntv+1;parent.frames[\'TargetFrame\'].history.go();}\nfunction countDown(){secsLeft--;showTime();}\nfunction showTime(){\ntemp = secsLeft;\ntemp2 = temp / (60*60);\nhours = Math.floor(temp2);\ntemp = temp - (hours*60*60);\ntemp2 = temp / 60;\nminutes = Math.floor(temp2);\ntemp = temp - (minutes*60);\nseconds = temp;\nif(hours < 10) hours = "0"+hours;\nif(minutes < 10) minutes = "0"+minutes;\nif(seconds < 10) seconds = "0"+seconds;\ndocument.getElementById(\'caption\').innerHTML=hours+\':\'+minutes+\':\'+seconds;\n}\nsetInterval(\'reloadFrame()\','+intv*1000+');\nsetInterval(\'countDown()\',1000);\nshowTime();\n</script/>\n';
docstr+='</html>';
frames['TimerFrame'].document.write(docstr);
}
}
</script>
[/code] [i=s] 本帖最后由 xlez 于 2009-11-11 15:06 编辑 [/i]
[color=red]资源收集器中[/color]输入
<script language="JavaScript">
setInterval("choose('1')",3000)
</script>
点运行,3000表示3秒 [quote]资源管理器输入
setInterval("choose('1')",3000)
点运行,3000表示3秒
[size=2][color=#999999]xlez 发表于 2009-11-11 08:07[/color] [url=http://bbs.ioage.com/cn/redirect.php?goto=findpost&pid=1101423&ptid=121098][img]http://bbs.ioage.com/cn/images/common/back.gif[/img][/url][/size][/quote]
是在地址栏输入吗?好像不行啊,会打开一个新的窗口 地址栏可以试试 javascript:setInterval("choose('1')",3000);void(0) [quote]地址栏可以试试 javascript:setInterval("choose('1')",3000);void(0)
[size=2][color=#999999]needed 发表于 2009-11-11 17:09[/color] [url=http://bbs.ioage.com/cn/redirect.php?goto=findpost&pid=1101785&ptid=121098][img]http://bbs.ioage.com/cn/images/common/back.gif[/img][/url][/size][/quote]
谢谢,不过我想问的是定时提交(刷新后也能重复执行),不是延时提交
我本来想通过框架的方式做,才疏学浅,那代码看着比较晕
页:
[1]