0
点赞
收藏
分享

微信扫一扫

解决窗口自适用大小

sullay 2023-09-21 阅读 49




<html>
  <head>
  </head>
  <body>
    <div  style="overflow:auto;">
     <form οnsubmit="getList() ;return false">
        <table class="query" align="center" width="99.5%" border="0" cellspacing="0" 
         cellpadding="0">
        </table>
     </form>
   </div>
    <table class="query" align="center" width="100%" border="0" cellspacing="0" 
       cellpadding="0" style="padding-left: 5px;">
          <tr>
            <td>
                <table id="devicelist"></table>
                <div id="pager"></div>
            </td>
          </tr>
        </table>
  </body>
</html>
<script type="text/javascript">
	var _list;  

	function _doResize() { 
		var ss = _getPageSize(); 
		_list.jqGrid('setGridWidth', ss.WinW-10).jqGrid('setGridHeight', ss.WinH-200); 
	   }
	   
	 function _getPageSize() { 
			//http://www.blabla.cn/js_kb/javascript_pagesize_windowsize_scrollbar.html 
			var winW, winH; 
			if(window.innerHeight) {// all except IE 
				winW = window.innerWidth; 
				winH = window.innerHeight; 
			} else if (document.documentElement && document.documentElement.clientHeight){
                              // IE 6 Strict Mode 
				winW = document.documentElement.clientWidth; 
				winH = document.documentElement.clientHeight; 
			} else if (document.body) { // other 
				winW = document.body.clientWidth; 
				winH = document.body.clientHeight; 
			}  // for small pages with total size less then the viewport 
			return {WinW:winW, WinH:winH}; 
	}
	 _list = $("#devicelist");
	 window.onresize = _doResize; 
</script>




举报

相关推荐

0 条评论