var winWidth = 0; var winHeight = 0; var winScreenHeight = 0; var winScreenWidth = 0; function initDialog(){ //获取屏幕宽度 if(window.screen.height){ winScreenHeight = window.screen.height; } if(window.screen.width){ winScreenWidth = window.screen.width; } //1366*768 //1440*900 //1024*768 if(winScreenWidth >= 1440 && winScreenWidth >= 900){ document.getElementById("mygrid_container_invoicelist").style.height = "420px"; }else if(winScreenWidth >= 1366 && winScreenWidth >= 768){ document.getElementById("mygrid_container_invoicelist").style.height = "350px"; }else if(winScreenWidth >= 1024 && winScreenWidth >= 768){ document.getElementById("mygrid_container_invoicelist").style.height = "300px"; } // //获取窗口宽度 // if (window.innerWidth) winWidth = window.innerWidth; // else if ((document.body) && (document.body.clientWidth)) // winWidth = document.body.clientWidth; // //获取窗口高度 // if (window.innerHeight) winHeight = window.innerHeight; // else if ((document.body) && (document.body.clientHeight)) // winHeight = document.body.clientHeight; //通过深入Document内部对body进行检测,获取窗口大小 // if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { // winHeight = document.documentElement.clientHeight; // winWidth = document.documentElement.clientWidth; // } //结果输出至两个文本框 }