1、a.asp页面为普通信息页面(不固定),b.asp页面为专门用来向数据库(SQL)提交错误信息的页面(用表单提交);
2、在a.asp页面,点击纠错链接,打开b.asp页面;
3、打开b.asp页面的同时,a.asp页面的“title"和“url"提交到b.asp页面的表单中。
哪位高手能告诉我,如何a.asp页面的"标题"(title)和"网址"(ur),传递给b.asp。
代码越详细越好,如果有完整代码参考请给出详细地址。
<%
Function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Msxml2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then
err.Clear
end if
End Function
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function GetPageTitle(HtmlContent)
Dim l,j,strTitle
l = InStr(LCase(HtmlContent), "<title>")
If l > 0 Then
l = l + 7
j = InStr(l, LCase(HtmlContent), "</title>")
If j > 0 Then
strTemp = Mid(HtmlContent, l, j - l)
Else
strTemp = "无法获取网页标题!"
End If
Else
strTemp = "无法获取网页标题!"
End If
GetPageTitle = strTemp
End Function
HtmlCldeContent = getHTTPPage("http://www.bc-cn.net/bbs/") '要提取页面的url地址
Title = GetPageTitle(HtmlCldeContent)
response.write(Title)
%>
[此贴子已经被作者于2006-5-21 17:06:03编辑过]