1、窗口自适应调整 (设置layout的fit属性值为true即可)
//窗口自适应调整 $(function() { windowResize(); //文档载入时加载 $(window).resize(function() { windowResize(); //窗口改变大小时加载 }); }); function windowResize() { var width = $(window).width()-10; //减去10与body中margin:5px共同作用:为body留的边距 var height = $(window).height()-10; // $('form#form1').width(width); // $('form#form1').height(height); // $('form#form1').layout(); //相当于<form id='form1' class='easyui-layout' data-options = "fit:true" runat="server"> $('#autoFitWindow').width(width); $('#autoFitWindow').height(height); $('#autoFitWindow').layout(); //为div设置 }
2、Javascript取URL传参(正则表达式)
a.html 发送请求页面
<script type="text/javascript"> function dbSelRow(){ var id= '001'; window.location.href = "b.html?id=" + id+"&name=sc"; } </script>
b.html 接收请求页面
<script type="text/javascript"> var CST_CODE; var id; $(function () { CST_CODE = Request.QueryString("cstCode"); id=Request.QueryString("id"); var name=Request.QueryString("name"); }); Request = { QueryString : function(paramName){ var reg = new RegExp("[?&]" + paramName + "=([^&]*)[&]?", "i"); var paramVal = window.location.search.match(reg); return paramVal == null ? "" : paramVal[1]; } } </script>