主题:  请教各位老师,谢!

fjxjgz

职务:普通成员
等级:1
金币:0.0
发贴:37
注册:2001/11/2 10:18:11
#12001/11/8 15:44:54
请老师指点代码
<%@LANGUAGE="VBSCRIPT"%>

<%
Dim rsNews__iSubjectID
rsNews__iSubjectID = "fSubjectID"
if (Request.Querystring("fSubjectID") <> "") then rsNews__iSubjectID =
Request.Querystring("fSubjectID")
%>
<%
set rsNews = Server.CreateObject("ADODB.Recordset")
rsNews.ActiveConnection = MM_connGBnews_STRING
rsNews.Source = "SELECT fNewsID, fTopic FROM tNews WHERE fSubjectID=" + Replace
(rsNews__iSubjectID, "'", "''") + " ORDER BY fDate DESC"
rsNews.CursorType = 0
rsNews.CursorLocation = 2
rsNews.LockType = 3
rsNews.Open()
rsNews_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 10
Dim Repeat1__index
Repeat1__index = 0
rsNews_numRows = rsNews_numRows + Repeat1__numRows
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form
parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>

str=""
<%
While ((Repeat1__numRows <> 0) AND (NOT rsNews.EOF))
%>
str=str+""
str=str+""
str=str+""
str=str+""
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsNews.MoveNext()
Wend
%>
str=str+"
">★<%=(rsNews.Fields.Item
("fTopic").value)%>
"

document.write (str)
<%
rsNews.Close()
%>
以上代码我是依照别人的办法所作,存为opennews.asp,在另一页面想用<script
language="javascrip" src="opennews.asp">调用,但不成功,特此请教。谢!




职务:普通成员
等级:1
金币:0.0
发贴:56
注册:2001/11/5 22:59:30
#22001/11/8 15:48:57
connGBnews.asp 你测试过没有?成功吗?



fjxjgz

职务:普通成员
等级:1
金币:0.0
发贴:37
注册:2001/11/2 10:18:11
#32001/11/8 15:53:19
诚在上个帖子中说
引用:
connGBnews.asp 你测试过没有?成功吗?


直接打开页面能成功,但在页面有很多行str="",中间才是正文,正文下是docment.write (str).就是链接不成功。