javascript 模拟sleep
需求:模拟表单提交并可设置提交间隔
还好页面是ajax提交的,只要写个js定时提交就ok了。 于是找了几个写的类似于sleep的功能,拿过来用用发现也不是很好用。
自已写了个
<script language="javascript">
var base = {};
......
base.auto_submit = function(){
var total = 100;
var i=0;
while(i<total){
if(i == total){
alert("over!");
return ;
}
setTimeout("base.form_submit()", 1000*i);
i++;
}
}
</script>
OK 时间间隔请求次数可以随便设。
相关文档:
用Javascript可以实现对GridView中某一行选择,而无需进行页面的刷新。
首先要在GridView的onrowdatabound的event handler中为GridView中的每一行onclick绑定event handler (Javascript)。假如GridView代码如下:
<asp:GridView runat="server" id="GridViewCategory" Aut ......
Several programming languages implement a sprintf function, to output a formatted string. It originated from the C programming language, printf function. Its a string manipulation function.
This is limited sprintf Javascript implementation. Function returns a string formatted by the usual printf co ......
这几天,我在读《Javascript语言精粹》。
这本书很薄,100多页,正好假日里翻翻。
该书的作者是Douglas Crockford,他是目前世界上最精通Javascript的人之一,也是Json格式的创造者。
他认为Javascript有很多糟粕。因为1995年Brendan Eich设计这种语言的时候,只用了三个月,很多语言特性没有经过深思熟虑,就推向了市 ......
以下以 IE 代替 Internet Explorer,以 MF 代替 Mozzila Firefox
1. document.form.item 问题
(1)现有问题:
现有代码中存在许多 document.formName.item("itemName") 这样的语句,不能在 MF 下运行
(2)解决方法:
&nb ......