js交互webBrowser


c#文件————————————————————————

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace testhtmscript
{
    [System.Runtime.InteropServices.ComVisible(true)]

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            webBrowser1.ObjectForScripting = this;
        }

        public void ClickEvent(string userName)


        {
            openFileDialog1.ShowDialog();
        }
    }


 
}

 

html文件————————————————————————
 <INPUT  type=button value=另存为 name=Button2 onclick="window.external.ClickEvent('asdfa')">
 


豫ICP备12024565号-1   E-mail:admin@hlc8.com