更新时间:2023-02-08 15:14:52
您可以指定哪些失败?
我的示例下面由一个web浏览器和一个按钮的形式。
My sample below consists of a form with a WebBrowser and a Button.
在年底对象调用y的句子我做到了!。所以我它的工作原理。
The object called y in the end has the sentence "i did it!". So with me it works.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
webBrowser1.DocumentText = @"<html><head>
<script type='text/javascript'>
function doIt() {
alert('hello again');
return 'i did it!';
}
</script>
</head><body>hello!</body></html>";
}
private void button1_Click(object sender, EventArgs e)
{
object y = webBrowser1.Document.InvokeScript("doIt");
}
}