yourUrl = "http://www.baidu.com/"
'打开IE
Set ie = WScript.CreateObject( "InternetExplorer.Application", "event_" )
ie.visible=True
'浏览网页
ie.navigate yourUrl
msgbox "开始遍历"
'扫描Input元素
set inputs =ie.document.getElementsByTagName("input")
i=0
for each input in inputs
WriteLineToFile(i&":[input:"&input.id&"]"&input.value)
i = i+1
next
'扫描textarea元素
set textareas =ie.document.getElementsByTagName("textarea")
i=0
for each textarea in textareas
WriteLineToFile(i&":[textarea:"&textarea.id&"]"&textarea.value)
i = i+1
next
'扫描form元素
set forms =ie.document.getElementsByTagName("form")
i=0
for each form in forms
WriteLineToFile(i&":[form:"&form.id&"]")
i = i+1
next
'====================================================
'函数:WriteLineToFile
'功能:输出到文件(不断累加)
'====================================================
Function WriteLineToFile( strLine )
Const ForReading = 1, ForWriting = 2,ForAppend=8
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("out.txt",ForAppend, True)
f.WriteLine strLine
End Function
时光机器(TimeAndGame.com)研究如何在游戏中加速学习,管理时间,获取各种定律,情绪管理,健康管理,投资管理和快乐生活