你的位置:
主页
>>
窗口特效
检测窗口占显示器的比例
加入如下代码到head区域
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin // IE Compatability by Errol Burrow (errol@thru.net) function getwindowsize() { if (navigator.userAgent.indexOf("MSIE") > 0) { var sSize = (document.body.clientWidth * document.body.clientHeight); return sSize; } else { var sSize = (window.outerWidth * window.outerHeight); return sSize; } return; } // End --> </script>
2.把如下代码加入<body>区域中
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin var percent = Math.round((getwindowsize()/(screen.width * screen.height)*100) * Math.pow(10, 0)); document.write("这个打开窗口占整个显示器的 " + percent + "% "); // End --> </script>