现在的位置: 首页 > 综合 > 正文

Javascript 调用后台方法

2012年07月11日 ⁄ 综合 ⁄ 共 413字 ⁄ 字号 评论关闭

http://www.cnblogs.com/zhoufeng/archive/2010/06/09/Javascript.html

 

注意:

1。没有返回值的函数, 再JS里面是不能调用的,操作数据库的方法,只能用ajax来调用

 

2. 掉后台函数,传参的办法

 

    public string ss(string ssValue) {
            return ssValue;
        }

上面是C#,下面是JS

    <script>
        function alertValue(id) {
            var s = '<%=ss("' + id + '") %>';
            alert(s);
        }
    </script>

 

    <input id="Text1" onclick=" alertValue(23)" />
    <input id="Text2" onclick=" alertValue(444)" />

抱歉!评论已关闭.