asp.net后台怎样获取前台JS的值?

来源:互联网 发布:比较好的梵高传记知乎 编辑:程序博客网 时间:2024/05/19 12:13

前台代码

    <script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>    <script type="text/javascript">        $(function() {            $.post("CacheDemo.aspx", { "strWidth": window.screen.width,"strHeight":window.screen.height }, function(data, status) {                if (status == "success") {                }            });});    </script>

后台代码

 protected void Page_Load(object sender, EventArgs e)        {            if (IsPostBack)                return;            string strWidth = Request["strWidth"];            string strHeight = Request["strHeight"];        }

0 0
原创粉丝点击