webbrowserのgetAttributeについて


じゅんてん  2009-01-05 01:33:16  No: 141202  IP: 192.*.*.*

VB20005のwebbrowserコンポーネントを使用して下記HTML内のonclick属性の値(下記例では  Jump()  )を取得したいのですがgetAttributeでvallueの値は取れるのですが、onclickの値は取得出来ません。

onclickは属性なのでgetAttributeで値が取れると思ったのですが
取れないのは何故なのでしょうか?
宜しければご教授頂けないでしょうか?お願いします。



HTMLソース

<head><script language="JavaScript">
<!--
function Jump(){
jumpurl=Math.floor(5*Math.random());
alert("Oh! My God!!") ;
}
//-->
</script>
<meta content="text/html; charset=UTF-8"><title>ddd</title></head>
<body>http-equiv="content-type"&gt;<form><input id="btn1" value="ボタン" onclick="Jump()" type="button"></form>
<br></body></html>




Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

        Dim doc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDocument

        Dim button1 As mshtml.HTMLInputElement

        button1 = doc.getElementById("btn1")
        
        If Not button1 Is Nothing Then
            MsgBox(button1.getAttribute("value"))
            MsgBox(button1.getAttribute("onclick"))
            System.Runtime.InteropServices.Marshal.ReleaseComObject(button1)
        End If

end sub

編集 削除