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

代码运行问题

TZTJ 发布于 2010-08-08 16:53, 822 次点击
请教高手,以下有一段代码,为什么有部分代码能正确运行,而有部分不能正确运行呢?
<%
sql="select top 1 * from aboutus"
rs.open sql,conn,1,1
if(not rs.eof) then
    Response.Write(replace(rs("bottomstr"),vbcrlf,"<br>"))
    Response.Write("<script language='javascript'>")
    Response.Write("document.write('"&rs("title")&"';)")   (在页面上没有内容,而表中有内容)
    Response.Write("</script>")
end if
rs.close
%>
8 回复
#2
yms1232010-08-08 19:02
Response.Write("document.write('"&rs("title")&"');")
#3
TZTJ2010-08-09 08:47
多谢版主.但问题还是不能解决.
#4
TZTJ2010-08-09 11:36
如果把它改为
<%
sql="select top 1 * from aboutus"
rs.open sql,conn,1,1
if(not rs.eof) then
    Response.Write(replace(rs("bottomstr"),vbcrlf,"<br>"))
    Response.Write(rs("title"))
end if
rs.close
%>
就可以.但原来代码为什么不行呢?能运行没有结果
if(not rs.eof) then
    Response.Write(replace(rs("bottomstr"),vbcrlf,"<br>"))
    Response.Write("<script language='javascript'>")
    Response.Write("document.write('"&rs("title")&"';)")   (在页面上没有内容,而表中有内容)
    Response.Write("</script>")
end if
 按语法来说应该没问题

[ 本帖最后由 TZTJ 于 2010-8-9 11:38 编辑 ]
#5
TZTJ2010-08-10 09:59
怎么没人感兴趣?是不是问题不值得讨论呢?
#6
funky2010-08-10 13:55
<%
sql="select top 1 * from aboutus"
rs.open sql,conn,1,1
if(not rs.eof) then
    Response.Write(replace(rs("bottomstr"),vbcrlf,"<br>"))
    Response.Write("<script language='javascript'>")
    Response.Write("document.write('"&rs("title")&"');")   '(在页面上没有内容,而表中有内容)
    Response.Write("</script>")
end if
rs.close
%>
#7
makebest2010-08-10 14:32
2楼的应该可以了, 页面上有没有内容, 不能光看 IE 界面, 还要查看源文件
#8
hams2010-08-10 15:50
如果rs("title")没有值的话
#9
TZTJ2010-08-11 09:05
rs("title")在源文件中的值是存在的.我已经检测过,直接用response.write(rs("title"))都能显示出来.
1