中国站长论坛

中国站长论坛 ›› 网络编程 ›› document.write 输出问题

页码: 1

document.write 输出问题

- zhgzzy 2008-07-21 14:59

我用html静态页面调用asp文件时,输出出错???在call newstitle 这个函数时,最后一个参数用到20时都可以,再大就输出不了??直接在地址输入newstitle.asp?keyid=1时是可以的,就是在静态页面输出时就不行了???

静态页面 test.html
<script src="include/newstitle.asp?keyid=1"></script>

动态页面 newstitle.asp
<!--#include file = "inc.asp"-->
<%
Select case request("keyid")
Case 1        
call newstitle(10,"top 10 id,title,content","newlist","order by idasc","show/?",160)
End Select
%>

inc.asp
Function Strleft(Str,L)
Temp_Str=len(Str)
if Temp_Str > L then
For I=1 To Temp_Str
Test_Str=(Mid(Str,I,1))
Strleft=Strleft&Test_Str
If Asc(Test_Str)>0 Then
lens=lens 1
Else
lens=lens 2
End If
If lens>=2*L Then Exit For
Next
else
Strleft=Str
end if
End Function

Function brandtitle(tnum,fsql,table,odby,reurl,strlong)      
    sql = "SELECT "&fsql&" FROM "&table&"  "&odby&" " 
    Set rs = Server.CreateObject("ADODB.Recordset")      
    rs.Open sql, comm, 1, 1
    If Not rs.EOF Then
      Dim temp   
    for i=1 to tnum
      temp = temp & "标题:"&rs(1)&"<br/>内容"&server.htmlencode(Strleft(rs(6),strlong))&"...<br/>"
      rs.MoveNext      
    next
      brandtitle = temp      
    Else     
      brandtitle = "无此信息."     
    End If
    response.write "document.write("""&brandtitle&""");"
    temp=""
    rs.close
    set rs=nothing
End Function

Re:document.write 输出问题

- s777 2008-07-22 23:34

inc

Re:document.write 输出问题

- ishion 2008-07-24 10:19

想在静态页面中调用,
newstitle.asp
中必须用<%
%>
document.write "output"

output才会被输出所有<%%>之间的内容在静态页中不起作用

页码: 1