日期:2014-05-17 浏览次数:20534 次
webBrowser1.DocumentText =
@"<html><head>
<script type='text/javascript'>
function testFunction() {
alert('test');
}
</script>
</head><body></body></html>";
webBrowser1.Document.InvokeScript("testFunction");
Dim ele As HtmlElement = MyWebbrowser1.Document.CreateElement("script")
ele.SetAttribute("type", "text/javascript")
ele.SetAttribute("text", "(function(){try{alert('文本')}catch(ex){alert(ex)}})()")
MyWebbrowser1.Document.Body.AppendChild(ele)
HtmlElement ele = MyWebbrowser1.Document.CreateElement("script");
ele.SetAttribute("type", "text/javascript");
ele.SetAttribute("text", "(function(){try{alert('文本')}catch(ex){alert(ex)}})()");
MyWebbrowser1.Document.Body.AppendChild(ele);