Private Sub Form_Load()
    Me.WebBrowser1.Navigate2 "https://login.taobao.com/member/login.jhtml"
End SubPrivate Sub Command2_Click()
    WebBrowser1.Document.getElementByID("TPL_username_1").Value = "yourname" '你的用户名  ''这句正确
    WebBrowser1.Document.getElementByNAME("TPL_password").Value = "password" '你的密码  ''这句提示错误了
    '由于密码中 id= 所以用name 但这句错误了,
End Sub
请问在<input 中没有ID 的怎么写?
还有是提交怎么写?谢谢!!

解决方案 »

  1.   

    没id的用name,有的连name都没有.那就只好模拟键盘类的程序了,直接sendkeys,不过稳定性就没那么强了.
      

  2.   

    WebBrowser1.Document.getElementByNAME("TPL_password").Value = "password"改为:
    WebBrowser1.Document.getElementsByNAME("TPL_password")(0).Value = "password"
      

  3.   

    以前看过一个帖子,里面提到一个思路: "它自己没有ID,你就给它一个ID"
    不知道能帮上楼上不.
    代码示例:
    webbrowser 控件中 修改网页源码Dim c As Integer
    c = 0
    If c = 1 Then Exit Sub ‘这个是为了防止这个过程无限执行下去
    c = c + 1
    Temp = WebBrowser1.Document.body.innerhtml
    Temp = Replace(Temp, "<BUTTON title=我接受", "<BUTTON ID=abc title=我接受")
    WebBrowser1.Document.body.innerhtml = TempWebBrowser1.Document.All("abc").Click
      

  4.   

    我也试了一下,密码这里用这句:
    WebBrowser1.Document.All("TPL_password").Value = "Password"
    不报错,但在XP sp3系统下,密码框输入为空,提示要安装个控件;
    在windows 2003系统下,密码输入成功.
      

  5.   

    你先模拟点击去掉安全登录的复选框 然后 赋值 然后模拟点击登录 其中由于登录按钮没有ID 没有名字 你可以遍历所有的对象 然后找出遍历过程中点击的ID值来模拟登录 这东西去年写过 另外还用淘宝他的按钮遍历时的数量ID 经常变