注册 登录
编程论坛 ASP技术论坛

[求助]大家帮我看看这个判断对不对。

ehvuclz 发布于 2007-01-22 16:20, 872 次点击
<%set rs=conn.execute("select top 1 * from ehvu_www_tongzi order by tz_id desc")
if cdate(rs("tz_times"))<date() or cdate(rs("tz_times"))=date() or cdate(rs("tz_timee"))>date() or cdate(rs("tz_timee"))=date() then%>
<SCRIPT language=javascript>
window.open('tongzi.asp', 'windowName', 'height=350, width=400, top=0,left=0, toolbar=no, menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
</script>
<%end if
rs.close
set rs=nothing%>

[此贴子已经被作者于2007-1-22 16:43:28编辑过]

9 回复
#2
tang6882007-01-22 16:32
cdate(date())?
画蛇添足?
已经是日期了还要转换成日期?
不明白你的意图
#3
ehvuclz2007-01-22 16:42
我已经改正了。可是这个判断的结果不对啊
#4
tang6882007-01-22 16:46
我不知道你的意图啊。
谁知道你的结果要的是什么啊。
哈哈
#5
ehvuclz2007-01-22 17:21
意图
就是想在符合规定的时间段里弹出窗口。不符合这个要求时就不要弹
#6
google2007-01-22 17:42
以下是引用ehvuclz在2007-1-22 16:20:00的发言:
<%set rs=conn.execute("select top 1 * from ehvu_www_tongzi order by tz_id desc")
if (cdate(rs("tz_times"))<date() or cdate(rs("tz_times"))=date()) and (cdate(rs("tz_timee"))>date() or cdate(rs("tz_timee"))=date()) then%>
<SCRIPT language=javascript>
window.open('tongzi.asp', 'windowName', 'height=350, width=400, top=0,left=0, toolbar=no, menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
</script>
<%end if
rs.close
set rs=nothing%>

把在一起的条件用()括起来

#7
做人很低调2007-01-22 22:56
LZ你写的判断就相当于下边这个判断
你自己看看是不是符合你的意思吧
if cdate(rs("tz_times"))<=date() or cdate(rs("tz_timee"))>=date() then

#8
ehvuclz2007-01-25 15:59
谢谢.
#9
wnjfzx2008-01-09 16:06
新手,兴奋中....
#10
yms1232008-01-09 16:15
在ASP中时间或日期应该是不能直接判断的,要用函数datediff
if cdate(rs("tz_times"))<date() or cdate(rs("tz_times"))=date() or cdate(rs("tz_timee"))>date() or cdate(rs("tz_timee"))=date() then
if datediff("d",rs("tz_times"),date())<0 or datediff("d",rs("tz_times"),date())=0 or datediff("d",rs("tz_timee"),date())>0 Or datediff("d",rs("tz_timee"),date())=0 Then
1