js执行后台代码
<script language="javascript">document.write("<%CsharpVoid();%>");</script>protected void CsharpVoid() { string strCC = "www.esoutong.com"; Response.Write(strCC); }<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script type="text/javascript"> function Say(strValue) { PageMethods.SayH(strValue, ShowMsg); } function ShowMsg(result) { var sResult = result.toString(); document.getElementById("rMsg").innerHTML = sResult; } </script></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" /> <input id="Button1" type="button" value="点击我" onclick="Say('你是猪');" /> </div> <div id="rMsg"> </div> </form></body></html>