奇怪的简单asp-js问题???

来源:百度知道 编辑:UC知道 时间:2024/05/18 12:15:04
静态生成时为保证详细页侧边的“最新资讯”栏目动态更新,于是想到了js嵌入!!即<script src="huodong.asp"></script>可是!!!!huodong.asp能正常运行,而只有一句代码<script src="huodong.asp"></script>的a.html却什么也没有!!!求助!!以下为huodong.asp的代码及运行效果:
<!--#include file="conn.asp" -->
<%
dim str
set rs=server.CreateObject("adodb.recordset")
str="select top 6 id,title from news where news_lanmu=4 order by id desc"
rs.open str,conn,1,1
if rs.eof then
str="<table width=""170"" border=""1"" align=""center"" cellpadding=""0"" cellspacing=""0"" class=""zi_orange"">"&" <tr>"& " <td width=""10"" height=""22""><img src=""/images/no_tuijian.gif"" width=""170"" height=""132&quo

把response.write "document.write('"&str&"');"
移到
%>
的下面
改成
document.write (<%=str%>)

你要输出JS代码

<!--#include file="conn.asp" -->
<%
dim str
set rs=server.CreateObject("adodb.recordset")
str="select top 6 id,title from news where news_lanmu=4 order by id desc"
rs.open str,conn,1,1
if rs.eof then
%>
document.writeln("<table width=\"170\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"zi_orange\"><tr><td width=\"10\" height=\"22\"><img src=\"\/images\/no_tuijian.gif\" width=\"170\" height=\"132\"><\/td><\/tr><\/table>");
<%