javascript 模拟监听功能
2011-10-15 23:02
148 查看
setInterval(initLogo,6000);
function initLogo(){
//对需要监听的对象监听
setInterval(initLogo,6000);
}
如果是局部刷新页面(监听),则不能使用这种方法,因为页面没有刷新,请求是每隔一段时间就会发送请求,这样请求数量就会以指数增长,这样会导致server崩溃
function listening(){
//对需要监听的对象监听
setTimeout(listening;6000);
}
则不会出现上面描述的问题
function initLogo(){
//对需要监听的对象监听
setInterval(initLogo,6000);
}
如果是局部刷新页面(监听),则不能使用这种方法,因为页面没有刷新,请求是每隔一段时间就会发送请求,这样请求数量就会以指数增长,这样会导致server崩溃
function listening(){
//对需要监听的对象监听
setTimeout(listening;6000);
}
则不会出现上面描述的问题
function whichElement(e) { var targ; var path = "<" + currenPath + ">"; if (SDCARD_STATU_ENABLED != sdCardStatu) { alert(dj('sd_label_no_sd_card')); return; } if (!e) { var e=window.event; } if (e.target) { targ=e.target; } else if (e.srcElement) { targ=e.srcElement; } if (targ.nodeType==3) // defeat Safari bug { targ = targ.parentNode; } if (window.win && (window.win.closed == false)) { window.win.close(); } path = path.replace(/\%/g, "%25"); path = path.replace(/\ /g, "%20"); path = path.replace(/\</g, "%3C"); path = path.replace(/\>/g, "%3E"); path = path.replace(/\//g, "%2F"); path = path.replace(/\&/g, "%26"); path = path.replace(/\=/g, "%3D"); path = path.replace(/\#/g, "%23"); var url = 'sd_upload.htm?path='+path; win = window.open(url, 'tree', 'scrollbars=yes,resizable=no,width=720,height=480'); watchChildWin(); $("#button_upload").attr("disabled", true); $("#button_upload").css("color", "#ACA899"); } function watchChildWin() { try { if ( null == win.document || (win.closed == true)) //firefox Google Opera { setControlDisable("button_upload", false); $("#button_upload").attr("style", "color:#000000"); } else { setTimeout("watchChildWin()", 100); } } catch(e) //ie { setControlDisable("button_upload", false); $("#button_upload").attr("style", "color:#000000"); } }
相关文章推荐
- javascript 模拟监听功能
- Javascript 代理模式模拟一个文件同步功能
- java IP地址,端口校验+下拉菜单选框监听事件+模拟QQ发送按钮旁的小箭头功能
- javascript模拟线程功能
- 使用javascript模拟观察者模式和事件监听广播机制
- java IP地址,端口校验+下拉菜单选框监听事件+模拟QQ发送按钮旁的小箭头功能
- JavaScript css3模拟简单的视频弹幕功能
- Javascript 利用键盘上的上下左右(回车)键模拟出tab 键的功能上下左右移动焦点
- JavaScript通过构造函数和原型的方式模拟C#类的功能
- javascript模拟实现类似c#下的hashtable的简单功能
- javascript模拟实现C# String.format函数功能代码
- javascript模拟实现C# String.format函数功能代码
- [原创] javascript使得按左右方向键可以切换链接(模拟Tab和Shift+Tab功能)
- JavaScript利用构造函数和原型的方式模拟C#类的功能
- jQuery插件jmodal模拟对话框实现javascript弹出对话框功能
- JavaScript利用构造函数和原型的方式模拟C#类的功能
- [原创]JavaScript模拟ACDSEE简单功能
- Javascript实现图片的预加载功能
- 提供前进、后退功能及其他JAVASCRIPT速成秘诀
- javaScript使用Lodop实现网页表格套打功能