前台后台相互调用(js调用c# & c#调用js)
一、 C#调用js
View Code
1 html 2 3 function FunctionName() {} 4 5 .cs文件 6 7 Page.ClientScript.RegisterStartupScript(this.GetType(), "key(随便起名字)", "<script>FunctionName();</script>");
二、JS调用C#
View Code
1 html 2 3 "<%=FunctionName()%>" 4 5 6 7 .cs文件 8 9 public string FunctionName() 10 { 11 12 string s=string.Empty; 13 14 .............. 15 16 return s; 17 18 }


浙公网安备 33010602011771号