<html><title>计算前十位斐波那契数值</title> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language="javascript"> function func2(){ var case3; var case2; alert("2") } function func1(){ var case1; var case2; alert("1") setTimeout("func2()",5000); }</script></head> <body> <Form name = "frm1" > <input type = "text" name = "txt1"> <input type = "button" name = "btn1" value = "确定" onclick="func1()"> </Form> </body></html>
楼上的楼上那个方法如果可行的话怎么弄啊? 我写了个... 不过这个方法..的局限性很强.不实用..不过写着玩.....^o^ <script type="text/javascript"> var wc = function () { this.a = 1; this.showSleep = function () { var a = 1, b = 2; window.sleep(this, this.showSleep, 1000, a, b);return; alert(this.a + a + b); } }function show() { var a = 0, b = 1; window.sleep(null, show, 5000, a, b);return; alert(a + b); }; show();function sleep(o, f, t) { new RegExp("window.sleep\\(([^)]+)\\);return;").exec(f.toString()); var fs = RegExp.rightContext.substring(0, RegExp.rightContext.length - 1); var as = RegExp.$1.split(/, ?/); for (var i = 3, ad = "var ", c = ""; i < as.length; i ++) { ad += c + as[i] + " = " + arguments[i]; c = ", "; } var rightFunction = new Function(ad + ";" + fs); var fun = function () { rightFunction.call(o); } window.setTimeout(fun, t); } var c = new wc; c.showSleep(); </script>
//想要的效果 function wait() { code1; code2; //当函数执行到这里的时候,停留指定的时间,再执行下去// code3; code4; }// 实现的代码 function wait() { code1; code2; //当函数执行到这里的时候,停留指定的时间,再执行下去 setTimeout(fun2,1000);//这里设定成停止一秒 } function fun2() { code3; code4; }
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language="javascript">
function func2(){
var case3;
var case2;
alert("2")
}
function func1(){
var case1;
var case2;
alert("1")
setTimeout("func2()",5000);
}</script></head>
<body>
<Form name = "frm1" >
<input type = "text" name = "txt1">
<input type = "button" name = "btn1" value = "确定" onclick="func1()">
</Form>
</body></html>
ASP中vbscript语法格式怎么写setTimeout
http://dev.cbw.com/web/asp/20051019301_4163470.shtml
http://topic.csdn.net/t/20060303/22/4591744.html至少有以下两种方法可以做到sleep,没有耗用掉所有cpu:
1。用XmlHttp访问一个页面,这个页面里Thread.sleep(10000)再响应。
2。用XmlHttp循环访问一个不存在的页面
我写了个...
不过这个方法..的局限性很强.不实用..不过写着玩.....^o^
<script type="text/javascript">
var wc = function () {
this.a = 1;
this.showSleep = function () {
var a = 1, b = 2;
window.sleep(this, this.showSleep, 1000, a, b);return;
alert(this.a + a + b);
}
}function show() {
var a = 0, b = 1;
window.sleep(null, show, 5000, a, b);return;
alert(a + b);
};
show();function sleep(o, f, t) {
new RegExp("window.sleep\\(([^)]+)\\);return;").exec(f.toString());
var fs = RegExp.rightContext.substring(0, RegExp.rightContext.length - 1);
var as = RegExp.$1.split(/, ?/);
for (var i = 3, ad = "var ", c = ""; i < as.length; i ++) {
ad += c + as[i] + " = " + arguments[i];
c = ", ";
}
var rightFunction = new Function(ad + ";" + fs);
var fun = function () {
rightFunction.call(o);
}
window.setTimeout(fun, t);
}
var c = new wc;
c.showSleep();
</script>
function wait()
{
code1;
code2;
//当函数执行到这里的时候,停留指定的时间,再执行下去//
code3;
code4;
}// 实现的代码
function wait()
{
code1;
code2;
//当函数执行到这里的时候,停留指定的时间,再执行下去
setTimeout(fun2,1000);//这里设定成停止一秒
}
function fun2()
{
code3;
code4;
}