1、請教ASP動態#include調用其他asp文件的問題
搞不懂你這么動態調用的意義在哪裡?
include的ASP文件,一樣是可以從資料庫中讀取的.並賦值給一個全局變數 .
你可以理解為,include是把一段代碼引進來,放到這個地方執行.實際並不會影響你頁面的調用(當然,你的位置要對).
2、asp 如何讀取遠程txt,並隨機調用其中幾行呢
讀取網站之外的文件 出於安全 沒有設計此機制 所以怕是不能實現
3、asp網站如何實現鏈接其他遠程網站資料庫?
問題是什麼資料庫,如果是Access,那就免談
如果是其他資料庫,對應相對的資料庫連接參數即可(前提是資料庫用戶允許遠程連接)
4、asp程序中如何調用遠程伺服器上的(比如:202.98.192.68)文件?
遠程是不允許用
<!--#include file="http://202.98.192.68/fun1.asp"-->
這么調用的。
這里只能包含本地文件。你只能把fun1.asp復制到本地。
或者用XMLHTTP遠程讀取這個文件的「顯示內容」。然後針對返回結果進行相應處理。
注意,是顯示內容,不是源文件。
5、在ASP中如何動態的讀取已有的變數?
s=split("a,b,c,d,e,f",",")
for i=0 to ubound(s)
response.write eval(s(i)) & "<br>"
next
關鍵是eval()函數
6、ASP網站調用另一個網站內容的問題
你隱藏了當然顯示不出來,還是沒太明白你的意思,如果你不會的話HI我吧,我教你做
你試試這段代碼:
<%
On Error Resume Next
Server.ScriptTimeOut=9999999
response.write(getHTTPPage("http://www.aaa.com/lianjie.asp"))
function getHTTPPage(url)
dim http
set http=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 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
%>
7、asp網站如何調用動態新聞標題
什麼意思?
你是不是指網站的TITLE呀?
接到ID ,查資料庫就可以了呀!
8、ASP代碼,遠程獲得伺服器文件,然後輸出到頁面
獲取遠程網址內容。
說明:
你可以把caiurl=""裡面的網址修改成你想要獲取的內容的網址就行了.
<%
response.Charset="GB2312"
Response.Expires = -9999
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
caiurl="http://www.163.com"
Function GetBody(weburl)
Dim ObjXMLHTTP
Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")
ObjXMLHTTP.Open "GET",weburl,False
ObjXMLHTTP.send
While ObjXMLHTTP.readyState <> 4
ObjXMLHTTP.waitForResponse 10000
Wend
GetBody=ObjXMLHTTP.responseBody
Set ObjXMLHTTP=Nothing
End Function
Function BytesToBstr(body,Cset)
'-----------------
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
'-----------------
End Function
pcontent=BytesToBstr(GetBody(caiurl),"gbk")
response.write(pcontent)
%>
程序演示:http://software.0576w.com/xmlhttp/
下載網址:http://software.0576w.com/download/xmlhttp.rar
9、asp中,news頁面如何動態調用新聞標題<%=rs("title_cn")%>
不知道你有沒有先寫上讀取資料庫的代碼,就像一樓說的那樣。如果沒有
給你寫一段
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};uid=;pwd=;dbq="&server.mappath("xxx.mdb")
set rs=server.createobject("adodb.recordset")
rs.open "select * from yyy",conn,1,1
這樣你就可以讀取資料庫中的數據了
其中xxx表示你的資料庫名稱,yyy表示你資料庫中某個表的名稱
10、asp.net js 腳本中用<%%>動態調用後台代碼
想法很好,但是這是不可行的。
<%%>的代碼是在伺服器端執行的,而js腳本是在客戶端的瀏覽器中執行的。也就是說<%%>會先於js執行。如果要在js中調用後台代碼,建議你使用Ajax。