htm文件内容
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
function write(str) {
document.getElementById("target").value = str;
}
</script>
<input type="text" id="target" />
</body>
</html>
winform代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace InterOperate
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Document.InvokeScript("write",new string[]{textBox1.Text});
}
private void Form1_Load(object sender, EventArgs e)
{
string path = System.Windows.Forms.Application.StartupPath;
webBrowser1.Url =new Uri(path + "/test.htm");
}
}
}
你没开玩笑吧!
强银