將HTML或txt文件轉(zhuǎn)換為ASP輸出的vbs代碼
更新時間:2011年01月20日 00:08:42 作者:
因為需要用asp輸出一段內(nèi)容,如果內(nèi)容過多的話,不斷的response.write太累,所以就需要用這斷代碼,方便用快速的轉(zhuǎn)換,其實只要是文本文件都可以輸出的。
使用方法:手工修改html文件的名稱與想要生成的asp的文件名稱,然后將下面的代碼保存為1.vbs,跟1.html放同一個目錄雙擊運行即可。
html = "1.html"
asp = "1.asp"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fhtml = fso.OpenTextFile(html, 1)
Set fasp = fso.OpenTextFile(asp, 2, true)
While fhtml.AtEndOfStream <> true
text = fhtml.ReadLine
text = "Response.Write "&""""&Replace(text, """", """""")&""""
fasp.WriteLine(text)
wend
fhtml.close
fasp.close
set fso = nothing
msgbox "success"
復(fù)制代碼 代碼如下:
html = "1.html"
asp = "1.asp"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fhtml = fso.OpenTextFile(html, 1)
Set fasp = fso.OpenTextFile(asp, 2, true)
While fhtml.AtEndOfStream <> true
text = fhtml.ReadLine
text = "Response.Write "&""""&Replace(text, """", """""")&""""
fasp.WriteLine(text)
wend
fhtml.close
fasp.close
set fso = nothing
msgbox "success"
相關(guān)文章
用vbs返回 Internet Explorer 的下載控件和 Applet 的列表
用vbs返回 Internet Explorer 的下載控件和 Applet 的列表...2007-04-04VBS教程:函數(shù)-DateDiff 函數(shù)
VBS教程:函數(shù)-DateDiff 函數(shù)...2006-11-11