如何用webbrowser获取网页中iframe的页面的表单内容。

weilams 2010-02-28 04:06:42
如题。
...全文
1818 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
fuda2 2012-03-21
  • 打赏
  • 举报
回复
好东西 看看
gshuli 2011-02-19
  • 打赏
  • 举报
回复
我也正好需要
max76332001 2010-07-26
  • 打赏
  • 举报
回复
正好需要此內容
SYSSZ 2010-03-01
  • 打赏
  • 举报
回复
试一试:

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print WebBrowser1.Document.getelementbyid("HasCheck").Value
End Sub
weilams 2010-03-01
  • 打赏
  • 举报
回复
谢谢楼上,成功获取了。
bcrun 2010-03-01
  • 打赏
  • 举报
回复
iframe内的可这样访问
'---------------------------------------------------------------------------------------
' 过程名 : ShowValue
' 时间 : 2010-3-1 13:24
' 作者 : 杨过.网狐.cn
' 功能 : 显示IFrame内某元素的值
'---------------------------------------------------------------------------------------
'
Sub ShowValue()
MsgBox WebBrowser1.Document.frames("TicketForm").Document.getelementbyid("HasCheck").Value
End Sub


我是把你的iframe页面内容改成这样后测的
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title> new document </title>
<meta name="generator" content="notepad">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
</head>

<body>
<TABLE>
<tr bordercolor="#00BF00">
<td height="27" class="style2"> 线路: </td>
<td align="left"> <input name="Line" type="text" class="input_3" id="Line2" size="20" readonly="true"> </td>
<td align="right" class="style2">售出: </td>
<td> <input name="HasSell" type="text" class="input_3" id="HasSell" size="5" readonly="true"> </td>
<td align="right" class="style2">已检: </td>
<td>
<input name="HasCheck" type="text" class="input_3" id="HasCheck" size="5" maxlength="5" value="ok"> </td>
<td align="right" class="style2">未检: </td>
<td> <input name="NotCheck" type="text" class="input_3" id="NotCheck" size="5" maxlength="5" readonly="true"> </td>
<td align="right" class="style2">班车状态: </td>
<td width="122"> <input name="Status" type="text" class="input_3" id="Status" size="10" maxlength="10" readonly="true"> </td>
</TR>
</TABLE>
</body>
</html>
鸭梨山大帝 2010-02-28
  • 打赏
  • 举报
回复
1. 先获取webbrowser访问后的HTML.
2.使用正则表达式匹配.
weilams 2010-02-28
  • 打赏
  • 举报
回复
我就是需要ticketcheck.jsp页面里HasCheck的值。
weilams 2010-02-28
  • 打赏
  • 举报
回复
好的
网页中的代码有以下这个代码:
<iframe name="TicketForm" id="TicketForm" width="950" height="565" src="TicketCheck.jsp" frameborder="0" scrolling="no"></iframe>
---------------------------------------

-------------------------------------
ticketcheck.jsp页面里有:

<tr bordercolor="#00BF00">
<td height="27" class="style2"> 线路:</td>
<td align="left"><input name="Line" type="text" class="input_3" id="Line2" size="20" readonly="true"></td>
<td align="right" class="style2">售出:</td>
<td><input name="HasSell" type="text" class="input_3" id="HasSell" size="5" readonly="true"></td>
<td align="right" class="style2">已检:</td>
<td>
<input name="HasCheck" type="text" class="input_3" id="HasCheck" size="5" maxlength="5" readonly="true"> </td>
<td align="right" class="style2">未检:</td>
<td><input name="NotCheck" type="text" class="input_3" id="NotCheck" size="5" maxlength="5" readonly="true"></td>
<td align="right" class="style2">班车状态:</td>
<td width="122"><input name="Status" type="text" class="input_3" id="Status" size="10" maxlength="10" readonly="true"></td>
bcrun 2010-02-28
  • 打赏
  • 举报
回复
建议楼主把你研究这个问题的测试用例贴上来,这样大伙帮你调试时也快些.毕竟,到这来问的,如果不是有现成答案而没有去找的或没找到的那种情况,多半要费较多功夫,省点时间大家都好:)

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧