I have this HTML code
<div class="anc-style" onclick="window.open('./view.php?a=foo')"></div>
I'd like to extract the contents of the "onclick" attribute. I've attempted to do something like:
div.GetAttribute("onclick").ToString();
Which would ideally yield the string
"window.open('./view.php?a=foo')"
but it returns a System.__ComObject.
I'm able to get the class by changing ("onclick") to ("class"), what's going on with the onclick?
HtmlElementCollection div = webBrowser1.Document.GetElementsByTagName("div");
for (int j = 0; j < div.Count; j++) {
if (div[j].GetAttribute("class") == "anc-style") {
richTextBox1.AppendText(div[j].GetAttribute("onclick").ToString());
}
}