“的onclick”按钮不会放弃使用VB.NET地址 [英] 'onclick' button not giving address using VB.NET

查看:87
本文介绍了“的onclick”按钮不会放弃使用VB.NET地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 VB.NET 做出投票宏。我就拥有了一切工作正常,除了按一下按钮。

code的按钮:

 <输入类型=按钮值=表决结果:Runelocus onclick=\"window.open('http://www.runelocus.com/toplist/index.php?action=vote&id=277&id2=333119125058'); setStatus(1);>

我每次单击此按钮,而不是得到的链接,我收到了 system._comobject

这是code我用得到的地址

 尝试
    昏暗ELE作为的HtmlElement = WebBrowser1.Document.ActiveElement    昏暗的目标作为字符串= ele.GetAttribute(onclick事件)
    目标= target.Replace('); setStatus(1);,的String.Empty)
    目标= target.Replace(window.open('的String.Empty)    e.Cancel = TRUE
    昏暗的窗口作为新的选民()
    window.Show()
    window.WebBrowser1.Navigate(目标)    status.Items.Add(目标)
抓住EX为例外
    MSGBOX(ex.Message.ToString)
结束Try


解决方案

试试这个:

 弱小目标的String = ele.DomElement.attributes(onclick事件)。value.ToString

I am using VB.NET to make a voting macro. I've got everything working fine, except for a button click.

Code for the button:

<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);">

Every time I click this button, instead of the getting the link, I get a system._comobject.

This is the code I'm using to get the address

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

解决方案

Try this:

Dim target As String = ele.DomElement.attributes("onclick").value.ToString

这篇关于“的onclick”按钮不会放弃使用VB.NET地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆