主题:if(.....){
hpycs
[专家分:30] 发布于 2008-01-30 22:06:00
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{
}
就不行了请高手帮忙
最后更新于:2008-01-30 22:15:00
回复列表 (共7个回复)
沙发
臭石头雪球 [专家分:23030] 发布于 2008-01-30 22:22:00
<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>
板凳
hpycs [专家分:30] 发布于 2008-01-30 22:50:00
不行啊?下面显示感叹号&完毕
3 楼
yaozheng [专家分:28410] 发布于 2008-01-30 22:54:00
应该是这样才对吧
if (<%=DateDiff("s", rs1("pan_shut"), time)%> > 0 ){
因为javascript可没有DateDiff这个函数。
4 楼
hpycs [专家分:30] 发布于 2008-01-30 23:36:00
还是不行啊,要怎样改
5 楼
臭石头雪球 [专家分:23030] 发布于 2008-01-30 23:43:00
[quote]还是不行啊,要怎样改[/quote]
汗,搞糊涂了。。。
你看看经过服务器解释后的 HTML 静态代码是什么?
6 楼
hpycs [专家分:30] 发布于 2008-01-31 00:40:00
[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 楼
臭石头雪球 [专家分:23030] 发布于 2008-01-31 09:55:00
经过服务器解释,怎么 script 没有啦???
我来回复