3

我正在使用VB.NET制作投票宏。除了单击按钮外,我一切正常。

按钮代码:

<input type="button" value="Vote: Runelocus" onclick="window.open('http://www.runelocus.com/toplist/index.php?action=vote&amp;id=277&amp;id2=333119125058'); setStatus(1);">

每次单击此按钮时,我都会得到一个system._comobject.

这是我用来获取地址的代码

Try
    Dim ele As HtmlElement = WebBrowser1.Document.ActiveElement

    Dim target As String = ele.GetAttribute("onclick")
    target = target.Replace("'); setStatus(1);", String.Empty)
    target = target.Replace("window.open('", String.Empty)

    e.Cancel = True
    Dim window As New Voter()
    window.Show()
    window.WebBrowser1.Navigate(target)

    status.Items.Add(target)
Catch ex As Exception
    MsgBox(ex.Message.ToString)
End Try
4

1 回答 1

1

尝试这个:

Dim target As String = ele.DomElement.attributes("onclick").value.ToString
于 2013-06-11T15:40:07.197 回答