程晓晖

博客园 首页 新随笔 联系 订阅 管理

1.后台方法:调用成员变量也行。
protected string CsharpVoid(string strCC)
{
return strCC;
}
2.javascript 调用
<script    language="javascript">
    var s = "<%=CsharpVoid("www.esoutong.com")%>";  
    document.write(s);
</script>

+++++++++++++++++第二种情况:
1.后代码:
protected void CsharpVoid()
      {
          string strCC = "www.esoutong.com";
          Response.Write(strCC);
      }
2.调用方法:CsharpVoid()
<script    language="javascript">
document.write("<%CsharpVoid();%>");
</script>

你可在页面中放一个按钮,把它设置为不可见style="display:none",然后,用脚本让此按钮点击
document.all("button1").click();
在此按钮的C#后台中写事件代码,这就是最简单的脚本调用C#方法.

posted on 2010-11-11 10:43  fumen  阅读(231)  评论(1编辑  收藏  举报