回 帖 发 新 帖 刷新版面

主题:if(.....){

rs1("pan_shut")是从数据库读出的时间

<script language="JavaScript">
function getResult(){
.....
}

function show(){
   if (DateDiff("s", rs1("pan_shut"), time)>0){
      window.location.href='sort1.asp';//刷新网页
   }else{
      timer=window.setInterval("getResult()",5000);
   }
}
</script>

<body style="background-color: #F0FBF1" onload="show()">
......
</body>

上面不知道哪里错误?
我试了下面1、2都可以:
1)
function show(){
   window.location.href='sort1.asp';//刷新网页
}

2)
function show(){
   timer=window.setInterval("getResult()",5000);
}

就是:
if(.....){

}else{

}

就不行了请高手帮忙

回复列表 (共7个回复)

沙发

<script language="JavaScript">
function getResult(){
.....
}

function show(){
   if (DateDiff("s", <%=rs1("pan_shut")%>, time)>0){
      window.location.href='sort1.asp';//刷新网页
   }else{
      timer=window.setInterval("getResult()",5000);
   }
}
</script>

<body style="background-color: #F0FBF1" onload="show()">
......
</body>

板凳

不行啊?下面显示感叹号&完毕

3 楼

应该是这样才对吧

if (<%=DateDiff("s", rs1("pan_shut"), time)%> > 0 ){

因为javascript可没有DateDiff这个函数。

4 楼

还是不行啊,要怎样改

5 楼

[quote]还是不行啊,要怎样改[/quote]

汗,搞糊涂了。。。

你看看经过服务器解释后的 HTML 静态代码是什么?

6 楼

[quote][quote]还是不行啊,要怎样改[/quote]

汗,搞糊涂了。。。

你看看经过服务器解释后的 HTML 静态代码是什么?[/quote]


<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="css.css">
<base target="main">
</head>

<body style="background-color: #F0FBF1"><div align="right">
<font color="#FF0000" size="2">


<table border="1" width="95%" cellspacing="0" height="112" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" cellpadding="0">
  <tr> 
     <td colspan="2" height="26" align="center" bgcolor="#008080">
     <font color="#FFFFFF">你的帐户</font></td>
  </tr>

  <tr>
     <td width="40%" align="center" height="25">帐号</td>
     <td width="60%" align="center" height="25">fjwwzh</td>
  </tr>
  
  <tr>
     <td width="40%" align="center" height="25">信用额度</td>
     <td width="60%" align="center" height="25">200000</td>
  </tr>  
    
  <tr>
     <td width="40%" align="center" height="25">货币单位</td>
     <td width="60%" align="center" height="25">人民币元</td>
  </tr>  

</table>


</div>
</font>

7 楼

经过服务器解释,怎么 script 没有啦???

我来回复

您尚未登录,请登录后再回复。点此登录或注册