| 前台html页面上有个按钮,点击后触发js方法,js方法调用C#,请问要怎么实现 
<html>
<head>
	 <title></title>
<script type="text/javascript">
     function bclick() {
         document.write("<%=CsharpVoid();%>");
     } 
</script>  
</head>
<body>
      <input id="Button1" type="button" value="click" onclick="bclick();" />    
</body>
</html>c#代码 
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;
using System.Threading;
using System.Web;
namespace go
{
    
    public partial class Form1 : Form
    {
       
        public Form1()
        {
            InitializeComponent();
        }
        
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("hello");
        }
        protected string CsharpVoid()
        {
            string strCC = "hello";
            return strCC;
        }
    }
} | |
| 4分 | 
PageMethods.CsharpVoid(funReady,funError);
function funReady(result){
       alert(result);
    }
function funError(err){ 
        alert("Error:" + err._message ); 
    }
[System.Web.Services.WebMethod]
public static string CsharpVoid()
        {
            string strCC = "hello";
            return strCC;
        } | 
| [System.Web.Services.WebMethod] 要引用哪个using? | |
| 
我草 这个牛逼了..js调用winfrom .. 而且 是纯winfrom 不是OCX
 | |
| 4分 | 
前台js <script type=”text/javascript” language=”javascript”> function Ceshi() { var a = “<%=Getstr()%>”; alert(a); } </script> <input type=”button” onclick=”Ceshi();” value=”js调用后台代码” /> 后台代码 public string Getstr() { string aa = “你们好啊!”; return aa; } | 
| 4分 | 
右击网站项目 添加引用 .net中 找 System.Web.Services 确定 还是推荐使用jQuery+ajax | 
| 
js调用winform的方法??? 不科学啊,你可以用webservice或者wcf做成服务来调用啊 | |
| 弹出来的是这个。。。。 | |
| 4分 | |
| 
 | |
| 
 求详解 | |
| 4分 | 
是在winform中么?可以这样试试:
 
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
webBrowser1.Document.GetElementById("bt_serch").Click += new HtmlElementEventHandler(SearchNoteList);
}
private void SearchNoteList(object ob, HtmlElementEventArgs e)  //点击了【搜索】按钮,查找关键字
{
HtmlElement el = (HtmlElement)ob;
...
}
//winform执行js函数
public object ExecJSfuncion(string func, object[] param)
        {
            return this.webBrowser1.Document.InvokeScript(func, param);
        }
//在主界面函数前添加
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
    public partial class MainForm : Form
{} | 
| 
借助webbrowser来实现。 添加一个winform,在该form里面添加一个webbrowser,并添加MainForm_Load事件处理。 public partial class MainForm : Form { public MainForm() { InitializeComponent(); }         private void MainForm_Load(object sender, EventArgs e)     <p> </body> 运行即可看到效果,其他复杂的通用的逻辑大家自己琢磨设计。 | |