1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

生成静态页的问题,求解!

本帖由 浪白鲨2006-05-16 发布。版面名称:后端开发

  1. 浪白鲨

    浪白鲨 New Member

    注册:
    2005-11-10
    帖子:
    26
    赞:
    0
    asp生成静态页时如果页面里面有如
    <script language="javascript" src="article/News.asp?Sid=9&Num=5"></script>
    的代码,读取htm内容的时候不会把News.asp里相应的内容显示出来,而是就一个
    <script language=……></script>,生成的页面就不完全!,怎么解决?
    :confused:
     
  2. 26ly

    26ly New Member

    注册:
    2005-11-28
    帖子:
    1
    赞:
    0
    能否把多点代码贴出来
     
  3. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    news.asp都写成js了,
    除非你用document.write('');
     
  4. 浪白鲨

    浪白鲨 New Member

    注册:
    2005-11-10
    帖子:
    26
    赞:
    0
    index.asp页面要调用新闻,我写在news.asp里面,然后在index.asp里面
    <script language="javascript" src="article/News.asp?Sid=8&Num=5"></script>
    其中8是文章分类id,5是文章数
    News.asp里面

    <%
    Sid=Request.QueryString("Sid")
    listNum=Request.QueryString("Num")

    Sql="SELECT TOP "& listNum &" title,articleid FROM Article WHERE Sid="& Sid& " ORDER BY hits desc,articleid asc"

    Set Rs=Server.CreateObject("ADODB.Recordset")
    Rs.Open Sql,Conn,1,1

    Response.Write"document.write('<table width=""100%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">');"
    Do while not Rs.eof
    %>
    document.write('<tr><td height="18"><img src="image/dot.gif" /><a href="article/read.asp?id=<%=Rs("articleid")%>" target="_blank" title="<%=Replace(Rs("title"),"'","")%>"><%=getchar(Replace(Rs("title"),"'",""),45)%></a></td></tr>');
    <%
    Rs.movenext
    loop
    Response.Write"document.write('</table>');"
    Rs.close
    Set Rs=nothing
    Call CloseConn
    %>
    getchar 是取文章标题长度的
    现在问题是我要把index.asp生成index.shtm,基本上正常,除了<script language……的地方,因为浏览器把它当js
    我生成一个页面是采用这个方法
     
    #4 浪白鲨, 2006-05-16
    最后编辑: 2006-05-16