如以下网页原码:
<div id="snapshot_icon">
<div class="right_text"><a href="javascript:SnapshotWin()">Snapshot</a></div>
<a href="javascript:SnapshotWin()">
<img class="left_img" alt="snapshot" src="pic/snapshot2.gif">
</a>
</div>SnapshotWin()代码:
function SnapshotWin()
{
MM_openBrWindow('snapshot.html','JPEGsnapshot','width=' + (Width + ss_width_offset) + ',height=' + (Height + ss_height_offset));
}
点击Snapshot时,出现一个新的html文件,请问在vb中如何实现点击动作,并保存新的html文件到硬盘里
<div id="snapshot_icon">
<div class="right_text"><a href="javascript:SnapshotWin()">Snapshot</a></div>
<a href="javascript:SnapshotWin()">
<img class="left_img" alt="snapshot" src="pic/snapshot2.gif">
</a>
</div>SnapshotWin()代码:
function SnapshotWin()
{
MM_openBrWindow('snapshot.html','JPEGsnapshot','width=' + (Width + ss_width_offset) + ',height=' + (Height + ss_height_offset));
}
点击Snapshot时,出现一个新的html文件,请问在vb中如何实现点击动作,并保存新的html文件到硬盘里
--------------------
怎样准确定位到 WebBrowser1.Document 里的内容?
则样查看 WebBrowser1.Document里的详细内容啊?
---------------------------------------
我找到这样的代码假设你的HTML代码如下:
<html>
<script>
function abcd(){
alert("haha");
return false;
}
</script><body>
<a id = 'xxx' href=# onclick="abcd()">ggggg</a>
</body>
</html>VB代码如下:
Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.***.com/***.html"
End SubPrivate Sub Command2_Click()
Dim a, b
Dim d As IHTMLDocument2
For Each a In WebBrowser1.Document.All
Debug.Print a.tagName
If (a.tagName = "SCRIPT") Then End If
If (a.tagName = "A") Then
If a.Id = "xxx" Then
a.FireEvent ("onclick")
End If
End If
Next点击Command1浏览这个网页,点击Command2运行其中的脚本abcd。
----------------------------------------------------
我的问题是怎么得到
<div id="skillshow"><span style='cursor:hand;' onclick=doskill('noskill')><img src=file:///e:/1/pet/skill/commonf.jpg border=0 alt=普通攻击></span>
网页代码的连接
并点击---------------------
Set hDoc = IzoneBrowser.Document
' Create an object to access the DOM and get to the submit button
' Dim hGen As MSHTML.HTMLGenericElement
Set hGen = hDoc.body
' Browser source: Id=positionsWatchLists ' a Command Button
' Set the created button equal to the button on the page,
' and set it to the index is 0
' Dim hSub As MSHTML.HTMLInputButtonElement
Set hSub = hGen.getElementById("positionsWatchLists", 0)
' Click the button
hSub.Click