如何让HTML文件显示ASP内容,不要用iframe,或者ASP生成HTML的方法,说的详细点
答案:4 悬赏:0
解决时间 2021-01-29 16:41
- 提问者网友:欲望失宠
- 2021-01-28 20:10
如何让HTML文件显示ASP内容,不要用iframe,或者ASP生成HTML的方法,说的详细点
最佳答案
- 二级知识专家网友:荒野風
- 2021-01-28 20:29
只生成一个页的话 试试下面的函数,把路径写好就可以了~
<%
’常用函数
’1、输入url目标网页地址,返回值getHTTPPage是目标网页之html代码
function getHTTPPage(url)
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=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function'' 2、转换乱玛,直接用xmlhttp调用有中文字符之网页得到之将是乱玛,可以通过adodb.stream组件进行转换
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
txtURL=server.MapPath("../index.asp")
sText = getHTTPPage(txtURL)
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
filename="../index.htm"
Set openFile=FileObject.OpenTextfile(server.mapPath(filename),2,true) ’true为不存在自行建立
openFile.writeline(sText)
Set OpenFile=nothing
%>
<%
’常用函数
’1、输入url目标网页地址,返回值getHTTPPage是目标网页之html代码
function getHTTPPage(url)
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=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function'' 2、转换乱玛,直接用xmlhttp调用有中文字符之网页得到之将是乱玛,可以通过adodb.stream组件进行转换
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
txtURL=server.MapPath("../index.asp")
sText = getHTTPPage(txtURL)
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
filename="../index.htm"
Set openFile=FileObject.OpenTextfile(server.mapPath(filename),2,true) ’true为不存在自行建立
openFile.writeline(sText)
Set OpenFile=nothing
%>
全部回答
- 1楼网友:英雄的欲望
- 2021-01-28 22:09
用脚本插入ASP文件就可以了,不过ASP文件中输出要以脚本输出的形式输出。</A>
- 2楼网友:躲不过心动
- 2021-01-28 22:02
用脚本<script src="XXXX.ASP"></script>ASP页面要用JAVASCRIPT的输出方式,比如document.write("需要显示的内容用ASP输出")
- 3楼网友:人類模型
- 2021-01-28 21:39
你的意思是HTML直接可以用来做程序?
这个需要有服务器权限,调试IIS才行。
这个需要有服务器权限,调试IIS才行。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯