标题: VBS如何逐行读取指定文件中的每一张图片并循环显示? [打印本页]
作者: yywd 时间: 2008-6-4 19:41 标题: VBS如何逐行读取指定文件中的每一张图片并循环显示?
逐行读取d:\0.txt循环显示0.txt中的每一张图片
<script language="vbscript"><!--
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("d:\0.txt", 1)
Do Until objFile.AtEndOfStream
tmpArray = objFile.ReadLine
For i = 0 to UBound(tmpArray)
Response.Write("<img src="tmpArray"><br>"))
'Next
'end
rs.MoveNext
Loop
'end if
objFile.Close
Set rs = Nothing
--></script>
哪里错了, 无法显示,更别说循环
作者: zqz0012005 时间: 2008-9-20 18:08
数组不是这么用的啊- dim tmpArray()
- i = 0
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objFile = objFSO.OpenTextFile("d:\0.txt", 1)
- Do Until objFile.AtEndOfStream
- tmpArray(i) = objFile.ReadLine
- i = i + 1
- loop
- For i = 0 to UBound(tmpArray)
- Response.Write("<img src='" & tmpArray(i) & "'>
- ")
- next
复制代码
达到你的目的其实用不着数组- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objFile = objFSO.OpenTextFile("d:\0.txt", 1)
- Do Until objFile.AtEndOfStream
- Response.Write("<img src='" & objFile.ReadLine & "'>
- ")
- loop
复制代码
作者: hbwhyin 时间: 2010-3-16 04:59
版主,我用你的怎么出错啦
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |