0
任何元素,這是我的代碼:的getElementsByTagName返回WebBrowser控件中
webBrowser1.ObjectForScripting = this;
string str =
"<html><head><script type=\"text/javascript\">" +
"var list = document.getElementsByTagName('abbr');" +
"len = list.length;" +
"for(i = 0;i < len;i++)" +
"{obj=list[i];obj.onclick=window.external.Test(this.id);}" +
"</script></head>" +
"<body>";
for (int i = 1000; i < 1100; i++)
{
str += "<abbr id=\'" + i.ToString() + "\'" +
">" + i.ToString() + " </abbr>";
}
str += "</body></html>";
webBrowser1.DocumentText = str;
感謝
哦,是的。你是對的。感謝您的答覆。但現在onclick事件並不會出現所有「簡要」元素 – ARZ 2011-02-06 11:16:08