掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
webbrowserのgetAttributeについて (ID:141202)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
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"><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
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.