100分问个jquery 返回值判断问题!function wait(){ $.get("wait.asp?randID="+Math.random(),function(data){
if(){ //这里写个判断句,不知道怎么写,谁帮帮忙啊!
$("tips").html(data); //如果大于5执行这句
}
else{
setTimeout(wait,1000);//如果小于5执行这句
}
});
}wait.asp<%dim a
a=int(rnd*10)
if a>5 then
response.Write("大于5!!")
response.End()
else
response.Write("小于5!!")
response.End()
end if
%>
<div id =tips></div>
if(){ //这里写个判断句,不知道怎么写,谁帮帮忙啊!
$("tips").html(data); //如果大于5执行这句
}
else{
setTimeout(wait,1000);//如果小于5执行这句
}
});
}wait.asp<%dim a
a=int(rnd*10)
if a>5 then
response.Write("大于5!!")
response.End()
else
response.Write("小于5!!")
response.End()
end if
%>
<div id =tips></div>
那句话,如果不大于5,就在次调用wait(),也就是说小于5那就话是永远不显示的!我就想知道怎么这个
功能怎么实现~~~~~~~~~在线等解答啊!!!!!先谢谢了
我这个返回值要是一句话,或者wait里有一对和数据库联系的句子怎么判断啊比如这样。。
wait.asp
<%
if rs("b")>rs("c") then
Conn.execute("update 表 set b=b-5 where 条件")
response.Write("大于5!!")
response.End()
else
Conn.execute("update 表 set b=b+5 where 条件")
response.Write("小于5!!")
response.End()
end if
%>
<div id =tips></div>
if rs("b")>rs("c") then
Conn.execute("update 表 set b=b-5 where 条件")
response.Write("true")
response.End()
else
Conn.execute("update 表 set b=b+5 where 条件")
response.Write("小于5!!")
response.End()
end if
%>
<script>
function wait(){ $.get("wait.asp?randID="+Math.random(),function(data){
if(data=="true"){ //这里写个判断句,不知道怎么写,谁帮帮忙啊!
$("tips").html("大于5!!"); //如果大于5执行这句
}
else{
setTimeout(wait,1000);//如果小于5执行这句
}
});
}<script>
<div id =tips></div>
a=int(rnd*10)
response.Write("<input type=hidden id=hid value=" & (a>5) & ">")
%>
$.get("info.aspx?randID="+Math.random(),function(data){
var rtn=$(data).find("#hid").val();
if(rtn)
$("#tips").innerHTML="大于5!!";
else
setTimeout(wait,1000);
});
var rtn=$(data).find("#hid").val();
if(rtn=="True")
$("#tips").text("大于5!!");
else
setTimeout(wait,1000);
});
就应该实现自动返回判断,但是没有想希望的那样,如果执行了else,settimeout
调用的wait()返回来的还执行else后边的,怎么才能自动要大于了执行上边的呢?test.asp
<script type="text/javascript" src="jquery.pack.js"></script><script>
function wait(){ $.get("test3.asp?randID="+Math.random(),function(data){
if(data=="yes"){
alert("上边") //这里写个判断句,不知道怎么写,谁帮帮忙啊!
//如果大于5执行这句
}
else{
alert("下边")
setTimeout(wait,1000);//如果小于5执行这句
}
});
}
</script>
<body>
<input type="button" style="width:50px; height:50px" onclick="wait();" />
</body>test3.asp
<%dim a
a=int(rnd*10)
if a>5 then
response.Write("yes")
response.End()
else
response.Write("zzzzz")
response.End()
end if
%>
if(data=="yes"){
alert("上边") //这里写个判断句,不知道怎么写,谁帮帮忙啊!
//如果大于5执行这句
}
else{
alert("下边")
setTimeout(wait,1000);//如果小于5执行这句
return;
}
});
}
function wait(){ $.get("wait.asp?randID="+Math.random(),function(data){
if(data=="大于5!!"){ //这里写个判断句,不知道怎么写,谁帮帮忙啊!
$("tips").html(data); //如果大于5执行这句
}
else{
setTimeout(wait,1000);//如果小于5执行这句
}
});
}只是补齐了一个判断,别的代码没有任何改动。
<%dim a
a=int(rnd*10)
if a>5 then
response.Write("yes")
response.End()
else
response.Write("zzzzz")
response.End()
end if
%> 只要在这里加入数据库,完了,返回值老执行这个下边的的,为什么加上数据库这样写就不行了?
function wait(){ $.get("test3.asp?randID="+Math.random(),function(data){
if(data=="yes"){
alert("上边") //这里写个判断句,不知道怎么写,谁帮帮忙啊!
//如果大于5执行这句
}
else{
alert("下边")
setTimeout(wait,1000);//如果小于5执行这句
}
});
}