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