当前位置 : 首页 » 编程语言 » 正文

javascript 循环调用示例介绍

分类 : 编程语言 | 发布时间 : 2018-04-21 09:06:21 | 浏览 : 0
复制代码 代码如下:

function checksdzt(){
sdzt = $("#viewObj_zt_text").val();
//循环调用,如果已经获取到了结果,则退出循环
loopgetinfo = setInterval("checksdztsub()",50); //这里循环调用,间隔50毫秒
}
function checksdztsub(){

if ($("#viewObj_zt_text").val() !="" && $("#viewObj_zt_text").val() != sdzt)
{
if($("#viewObj_zt_text").val() == "锁定")
{
$("#sdyydes").html("<font color='red'>*</font> 锁定原因");
$("#viewObj_sdyy_text").attr("validate","{required:true}");
}
else if($("#viewObj_zt_text").val() == "正常")
{
$("#sdyydes").html(" 锁定原因");
$("#viewObj_sdyy_text").attr("validate","");
}
else

sdzt = $("#viewObj_zt_text").val();
// clearInterval(loopgetinfo); //终止循环
}
}

相关阅读:

Remove duplicates from an array of objects in JavaScript

Can I call jquery click() to follow an <a> link if I haven't bound an event handler to it with bind or click already?

Check whether a string matches a regex in JS

jQuery event to trigger action when a div is made visible

Check if user is using IE with jQuery

Resize HTML5 canvas to fit window

How do I replace a character at a particular index in JavaScript?

JavaScript file upload size validation

Converting a string to a date in JavaScript

How to get the data-id attribute?