[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public partial class Main : Form
{
public Main()
{
InitializeComponent();
}
private void button4_Click(object sender, EventArgs e)
{
this.webBrowser1.Navigate(this.textBox1.Text);
this.webBrowser1.ObjectForScripting = this;
}
#region JavaScript中调用的方法
public string InvokeFormMethod(string message)
{
MessageBox.Show(message);
return "Charles2008";
}
#endregion
#region 调用Javascript方法
private void button6_Click(object sender, EventArgs e)
{
this.webBrowser1.Document.InvokeScript("msgalert", new string[] { "Called from client code" });
}
#endregion
}