当前位置: 代码迷 >> vbScript >> vbs 自动填表 还是下拉列表,该怎么处理
  详细解决方案

vbs 自动填表 还是下拉列表,该怎么处理

热度:6562   发布时间:2013-02-26 00:00:00.0
vbs 自动填表 还是下拉列表
<form method="post" name="login" id="loginform" class="gateform" onsubmit="pwdclear = 1;ajaxpost('loginform', 'returnmessage', 'returnmessage', 'onerror');return false;" action="logging.php?action=login&amp;loginsubmit=yes">
<h3 id="returnmessage">用户登录</h3>
<input type="hidden" name="formhash" value="0dd4914b" />
<div class="loginform nolabelform">
<div class="selectinput">
<select name="loginfield" style="float:left;width:50px;" id="loginfield">
<option value="username">用户名</option>
<option value="uid">UID</option>
</select>
<input type="text" name="username" autocomplete="off" size="36" class="txt" tabindex="1" value="" />
</div>
<p class="selectinput loginpsw">
<label for="password3">密 码 :</label>
<input type="password" id="password3" name="password" onfocus="clearpwd()" onkeypress="detectcapslock(event, this)" size="36" class="txt" tabindex="1" />
</p>
<div class="selecttype">
<select id="questionid" name="questionid" change="if($('questionid').value > 0) {$('answer').style.display='';} else {$('answer').style.display='none';}">
<option value="0">安全提问</option>
<option value="1">母亲的名字</option>
<option value="2">爷爷的名字</option>
<option value="3">父亲出生的城市</option>
<option value="4">您其中一位老师的名字</option>
<option value="5">您个人计算机的型号</option>
<option value="6">您最喜欢的餐馆名称</option>
<option value="7">驾驶执照的最后四位数字</option>
</select>
</div>
<p><input type="text" name="answer" id="answer" style="display:none" autocomplete="off" size="36" class="txt" tabindex="1" /></p>
</div>





自动填表,为什么提示找不到对象
ie.Document.login.username.value="abcde"
ie.Document.login.password3.value="123456"
ie.Document.login.questionid(5).selected=True
ie.Document.login.answer.value="ibm"
ie.document.loginform.submit()


提示这行有错
ie.Document.login.questionid(5).selected=True



------解决方案--------------------------------------------------------
VBScript code
Set ie = CreateObject("InternetExplorer.Application")ie.Navigate "http://bbs.gdmm.com/logging.php?action=login"ie.Visible = TrueCall SynchronizeIEie.Document.login.username.value="abcde" ie.Document.login.password3.value="123456"ie.Document.login.questionid.options(0).value=5 ie.Document.login.questionid.options(0).selected=True ie.Document.login.answer.value="ibm" ie.Document.getElementById("answer").style.display=""ie.Document.login.submit()Sub SynchronizeIE    'On Error Resume Next    Do While(ie.Busy)    WScript.Sleep 100    LoopEnd Sub
  相关解决方案