js调用后台、后台调用前台等方法总结_javascript技巧
时间:2021-07-01 10:21:17
帮助过:21人阅读
js调用后台,后台调用前台等方法总结
1. javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入Button1_Click中;
代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
this.TextBox1.Text = "voodooer";
}
2、在前台可以这样调用:
代码如下:
方法二:1、函数声明为public 或者protected
代码如下:
public string ss()
{
return("voodooer");
}
2、 前台调用方法
代码如下: