当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > vbs自动填表单分析附源码

VBScript
NYboy.vbs病毒源代码公布,我来模拟熊猫烧香
vbs脚本病毒生成器 下载
用vbs实现返回 IP 配置数据
mdir.vbs 建立隐藏虚拟目录的vbs
改进后的mkw3site.vbs(创建虚拟目录)
charCodeAt与AscW函数的区别说明
vbs中Empty和Null的区别
用vbs将名称转换为正确的大小写的代码
用vbs实现更改计算机的说明的代码
vbs中使用 ADO 读取所有数据均在一行上的文本文件的代码
用vbs检测Internet Explorer 中是否启用了 ActiveX
在vbs运行命令行工具后让命令窗口保持打开状态的脚本
用vbs读取远程计算机上的文本文件的代码
用vbs从本地 Administrators 组中删除组
用vbs删除前一天创建的备份文件
不错的一篇VBS-JSCRIPT GETOBJECT理解
VBS ArrayList Class vbs中的数组类
如何调试JScript/VBScript的方法
如何通过计划任务调用QuickTest测试脚本
用vbs实现按创建日期的顺序列出一个文件夹中的所有文件

VBScript 中的 vbs自动填表单分析附源码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 233 ::
收藏到网摘: n/a

dim ie
set ie=createobject("internetexplorer.application")
ie.visible=true
ie.navigate "http://www.ln.chinaunicom.com/index.shtml"
While ie.busy or ie.readystate<>4
EndWhile
ie.document.all("userid").value= "13304948957"'手机号码
ie.document.all("passwd").value = "111111"'密码
ie.document.all("verifycode").value = "1111"'识别码
ie.document.all.loginOnForm.submit
一调试脚本就显示 缺少对象:"ie.document.all("....")"
"ie.document.all.loginOnForm.submit"这行还显示对象不支持此属性或者方法
请各位大侠帮忙看看 哪里出了错 谢谢啦
提问者: fxdca2008 - 试用期 一级
最佳答案
楼主代码有几处错误:
1. EndWhile应为Wend
2. 网页上的手机号码、密码等表单元域其实是在一个<iFrame>中的网页上,不能直接调用,而应该使
用ie.document.frames(0).document.loginOnForm...来调用
正确代码如下(可以自动填写交提交,提交上去以后会返回“识别码错误”的提示,属于正常现象)

Sub test()
Dim ie
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate "http://www.ln.chinaunicom.com/index.shtml"
While ie.busy Or ie.readystate <> 4
Wend
ie.document.frames(0).document.loginonform.UserId.Value = "13304948957" '手机号码
ie.document.frames(0).document.loginonform.passwd.Value = "111111" '密码
ie.document.frames(0).document.loginonform.verifycode.Value = "1111" '识别码
ie.document.frames(0).document.loginonform.submit
End Sub