首页 > 代码库 > VBS操作JS网页元素实例
VBS操作JS网页元素实例
‘==========================================================================
‘
‘ VBScript Source File -- Created with SAPIEN Technologies PrimalScript 4.0
‘
‘ NAME:
‘
‘ AUTHOR: Microsoft , Microsoft
‘ DATE : 2014/8/14
‘
‘ COMMENT:
‘
‘==========================================================================
dim Ie,obj
set Ie =wscript.createobject("internetexplorer.application")
ie.navigate "www.baidu.com"
wscript.sleep 1000
ie.menubar=1 ‘ÏÔʾIE¶ÔÏó²Ëµ¥À¸
ie.AddressBar=1 ‘ÏÔʾIE¶ÔÏóµØÖ·À¸
ie.ToolBar=1 ‘ÏÔʾIE¶ÔÏ󹤾ßÀ¸
ie.StatusBar=0 ‘²»ÏÔʾIE¶ÔÏó״̬À¸
ie.FullScreen=0 ‘È«ÆÁ»¯IE¶ÔÏó
ie.Resizable=0 ‘ÉèÖÃIE¶ÔÏó´óСÊÇ·ñ¿ÉÒÔ±»¸Ä¶¯
ie.visible=1 ‘ÉèÖÃÊÇ·ñ¿É¼û
set obj = ie.document
for i=0 to obj.all.length-1
If obj.all(i).tagname="INPUT" Then
If obj.all(i).value="http://www.mamicode.com/°Ù¶ÈÒ»ÏÂ" Then
WScript.Sleep 1000
obj.all(i).click
End If
End If
Next
Set obj=Nothing
‘================================================
‘ x=ie.document.getElementsByTagName("form")
‘ WScript.Sleep 1000
‘ x.submit
‘=======================================================
‘ wscript.sleep 1000
‘ set obj = ie.document
‘ ‘‘‘‘‘‘‘‘‘Ä¿µÄ:²âÊÔ µÇ¼°´Å¥‘‘‘‘
‘ For i=0 to obj.all.length-1
‘ If obj.all(i).tagname="input" Then
‘ if obj.all(i).value="http://www.mamicode.com/°Ù¶ÈÒ»ÏÂ" Then
‘ WScript.Sleep 1000
‘ obj.all(i).click
‘ end If
‘ End if
‘ Next