当前位置:首页 > C#教程 > C#高级

C#后台调用前台js封装方法

其他不多说,直接上例子,我引用的是layer弹框的移动端插件

一、页面<head>调用下面方法

<script src="/js/layer.js"></script>
    <script>
        function alertFn(msg) {
            layer.open({
                content: msg ,
                shadeClose: false,
                btn: [OK],
                yes: function () {
                    location.href = "default.aspx?i=" + Math.random();
                },
            });
        }
</script>

 

二、后台调用方法

 ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>alertFn(‘前台弹出的信息‘);</script>"); 

 

原文:http://www.cnblogs.com/zFelix/p/5754080.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!