asp a onclick

来源:百度知道 编辑:UC知道 时间:2024/05/17 22:16:04
<a <% if Datediff("d",data,Now())>30 and Session("username")=null and Session("username")="" then%> href="#" onClick="GetTime()"<%else%> href="http://<%=link%>" target="_blank"<%end if%>class="blue12"><%=rs("NewsTitle")%></a>
这里究竟哪里出错了下面是调用的函数,参数data是新闻发布的时间已经从数据库读出来赋值了!

sub GetTime(data)
if Datediff("d",data,Now())>30 and Session("username")=null and Session("username")="" then
response.Write("<script language=javascript> alert('menber do only allow to read this news , please login!') </script>")
end if
end sub
抱歉上面有点错误onclick="GetTime(Data)"
木土生 这样子改还是没有任何反应,好像根本不去执行判断的sub代码,烦哦!又不能调试……

sub GetTime(data)
if Datediff("d",data,Now())>30 and Session("username")=null and Session("username")="" then
GetTime="<script language=javascript>alert('menber do only allow to read this news , please login!');</script>"
else
GetTime=""
end if
end sub

你的函数只输出东西,并没有给函数附值,如何直接执行呢?
如果是输出,调用函数时需要call GetTime(data)