微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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" onclick="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

原文地址:https://www.jb51.cc/vb/258696.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐