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

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强制返回为文本 --------------------------...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办法, Format 或者FormatDateTime 竟然结果和...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace My ‘全局错误处理,新的解决方案直接...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用的爽呀,这篇文章写与2011年,看来我以前没...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选中的单元格进行处理 Dim m As Range, t...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integ...