小弟想做一个文件升成器来编写网页用 我想打出一个我特定的字串到文件内
这是我现在的源代码
Private Sub Command1_Click()Dim fs As FileSystemObject
Dim a As TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\aaab.js")
trhead = "document.write('<tr bgcolor=#666666>')"tablehead = "document.write('<table width=800 background=#666666 border=0> ')"
trend = "document.write('</tr>')"
tableend = "document.write('</table>')"
a.WriteLine (tablehead)
i = countt / 4
For i = 1 To 3
a.WriteLine (trhead)For ii = 1 To 4ex(ii) = "<a href=" + urltm(iii) + " > """
tdhead = "document.write('<td>" + ex(iii) + item(iii) + "</td>')"a.WriteLine (tdhead)
iii = iii + 1
Next
a.WriteLine (trend)
Next
a.WriteLine (tableend)
a.Close
End Sub
上面的内容也可以执行。执行结果为
document.write('<table width=800 background=#666666 border=0> ')
document.write('<tr bgcolor=#666666>')
document.write('<td><a href= > 主页</td>')
document.write('<td><a href= > 主页</td>')
document.write('<td><a href= > 主页</td>')
document.write('<td><a href= > 主页</td>')
document.write('</tr>')
document.write('<tr bgcolor=#666666>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('</tr>')
document.write('<tr bgcolor=#666666>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('<td></td>')
document.write('<td></td>')
document.write('</tr>')
document.write('</table>')//////////////////////////////////////////
上面大家也看到了 只有 '这个符号 没有"这个符号
哪位哥哥可以告诉我怎样做 文件内打入"这样的符号啊
比如下面这一句话
document.write('<td><a href="/abc"> 主页</td>')
这是我现在的源代码
Private Sub Command1_Click()Dim fs As FileSystemObject
Dim a As TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\aaab.js")
trhead = "document.write('<tr bgcolor=#666666>')"tablehead = "document.write('<table width=800 background=#666666 border=0> ')"
trend = "document.write('</tr>')"
tableend = "document.write('</table>')"
a.WriteLine (tablehead)
i = countt / 4
For i = 1 To 3
a.WriteLine (trhead)For ii = 1 To 4ex(ii) = "<a href=" + urltm(iii) + " > """
tdhead = "document.write('<td>" + ex(iii) + item(iii) + "</td>')"a.WriteLine (tdhead)
iii = iii + 1
Next
a.WriteLine (trend)
Next
a.WriteLine (tableend)
a.Close
End Sub
上面的内容也可以执行。执行结果为
document.write('<table width=800 background=#666666 border=0> ')
document.write('<tr bgcolor=#666666>')
document.write('<td><a href= > 主页</td>')
document.write('<td><a href= > 主页</td>')
document.write('<td><a href= > 主页</td>')
document.write('<td><a href= > 主页</td>')
document.write('</tr>')
document.write('<tr bgcolor=#666666>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('</tr>')
document.write('<tr bgcolor=#666666>')
document.write('<td>主页</td>')
document.write('<td>主页</td>')
document.write('<td></td>')
document.write('<td></td>')
document.write('</tr>')
document.write('</table>')//////////////////////////////////////////
上面大家也看到了 只有 '这个符号 没有"这个符号
哪位哥哥可以告诉我怎样做 文件内打入"这样的符号啊
比如下面这一句话
document.write('<td><a href="/abc"> 主页</td>')
换成:tdhead = "document.write('<td>"" + ex(iii) + item(iii) + ""</td>')"
比如 读取一个
<table width=800 background=#666666 border=0 name=abc>
像这样一行。但是我首先不确定他在第几行。我只想读取出他的name 后面的值。。 这样怎么做啊 哪位哥哥指点一下。
CodeOK = True
FilmList.Clear
PathList.Clear
Do While InStr(1, SouCode.Text, "MM_openBrWindow('")
Jump:
SouCode.Text = Right(SouCode.Text, Len(SouCode.Text) - InStr(1, SouCode.Text, "MM_openBrWindow('") - 16)
PathList.ListIndex = PathList.ListCount - 1
Dim tmpPath, NewPath As String
tmpPath = Left(SouCode.Text, InStr(1, SouCode.Text, "'") - 1)
If Left(tmpPath, 4) = "http" Then
NewPath = tmpPath
Else
NewPath = "http://www.avl.com.cn/movie/" & tmpPath
End If
If NewPath = PathList.Text Then
GoTo Jump
Else
PathList.AddItem NewPath
End If
SouCode.Text = Right(SouCode.Text, Len(SouCode.Text) - InStr(1, SouCode.Text, "《"))
FilmList.AddItem Left(SouCode.Text, InStr(1, SouCode.Text, "》") - 1)
Loop
cbPage.Enabled = True
FilmList.Enabled = True
FilmList.ListIndex = 0
FilmList.ToolTipText = "本页共有 " & FilmList.ListCount & " 部影片"
End Sub
我忘记了instr的第一个参数是可以设定从哪里开始找起的,问题就出在这
像你的问题,先找到name=出现的位置,记录在一个变量p里,然后在p后面找>,记在p2里,用mid把name之间的文本记下来,就是你要的文本,然后循环,从p2往后找name=虽然也不可能很快(操作大量文本的确不容易快起来),但肯定要比前面的代码快很多,你试试看吧