VB自动填表问题 bs自动填表的实现

VB自动填表问题

自动填写下面的表单标题栏:<input name="subject" id="subject" class="txt" value="" tabindex="1" /></span>内容栏:<textarea class="autosave max" name="message" id="e_textarea" tabindex="1" class="txt" style="height:300px"></textarea>提交按钮:<button type="submit" id="postsubmit" value="true" name="topicsubmit" tabindex="1">提交</button>
答:
引用Microsoft HTML Object Library 代码: Option Explicit Private Sub Command1_Click() Dim doc As MSHTML.HTMLDocument Set doc = WebBrowser1.document Dim inpute As MSHTML.IHTMLInputElement Set inpute = doc.getElementById("subject") inpute.Value = "这是要填的subject" Dim e As MSHTML.IHTMLElement Set e = doc.getElementById("e_textarea") e.Value = "message" Set e = doc.getElementById("postsubmit") e.Click End Sub Private Sub Form_Load() WebBrowser1.navigate "h:\1.html" End Sub '以下是1.html的内容 '<html><body> '<input name="subject" id="subject" class="txt" value="" tabindex="1" /> '<textarea class="autosave max" name="message" id="e_textarea" tabindex="1" class="txt" style="height:50px"></textarea> '<button type="submit" id="postsubmit" value="true" name="topicsubmit" tabindex="1" οnclick="javascript:alert(1);">提交</button> '</body></html> 'by xsoft [http://281131020.qzone.qq.com]'要自动填写的话,加入下列代码:Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)   If (pDisp Is WebBrowser1.Object) Then      Command1.Value = True   End IfEnd Sub

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值