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 时间间隔请求次数可以随便设。
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
用Javascript可以实现对GridView中某一行选择,而无需进行页面的刷新。
首先要在GridView的onrowdatabound的event handler中为GridView中的每一行onclick绑定event handler (Javascript)。假如GridView代码如下:
<asp:GridView runat="server" id="GridViewCategory" Aut ......
Return a formatted string
function sprintf ( ) {
// Return a formatted string
//
// version: 909.322
// discuss at: http://phpjs.org/functions/sprintf // + original by: Ash Searle (http://hexmen.com/blog/)
// + namespaced by: Michael White (http://getsprink.com)
......
以下以 IE 代替 Internet Explorer,以 MF 代替 Mozzila Firefox
1. document.form.item 问题
(1)现有问题:
现有代码中存在许多 document.formName.item("itemName") 这样的语句,不能在 MF 下运行
(2)解决方法:
&nb ......
按钮式:
<INPUT name="pclog" type="button" value="GO" onClick="location.href='url'">
直接跳转式:
<script>window.location.href='url';</script>
<SCRIPT LANGUAGE="javascript">
<!--
window.open
('page.html' ......