2010-3
5
下面是替换网页里字符的代码
Dim webdoc As HTMLDocument
Dim texbody As HTMLBody
Dim Rng As IHTMLTxtRange
On Error Resume Next
Set webdoc = m_IE.Document
Set texbody = webdoc.body
Set Rng = texbody.createTextRange()
Do
If Rng.FindText(“情色”) = False Then Exit Do
Rng.Select
Rng.pasteHTML “过滤”
Loop**********************************
替换链接:
Dim i As IntegerFor i = webdoc.links.length – 1 To 0 Step -1If InStr(1, webdoc.links(i).outerHTML, “http://www.sex.com”, vbTextCompare) Thenwebdoc.links(i).outerHTML = “<a href=’http://www.maxthon.com/’>http://www.maxthon.com/</a>”End IfNext**********************************替换FORM提交地址
- dim cForm
- set cForm = webdoc.getElementsByTagName(“form”)
- if cForm.length>0 then
- For i = cForm.length – 1 To 0 Step -1
- If InStr(1, cForm(i).outerHTML, “http://www.sex.com”, vbTextCompare)>0 Then
- cForm(i).outerHTML = “<a href=’http://www.maxthon.com/’>http://www.maxthon.com/</a>”
- End If
- Next
- end if
- set cForm = Nothing

还没有任何评论。