<html>
<head>
<script type="text/javascript">
    var w;
    //window.open(URL,name,features,replace)打开一个窗口
    function openwin()
    {
	    w=window.open('', 'width=100,height=100');
	    w.focus();
    }
    //设置窗口的大小
    function setSize()
    {
	    w.resizeTo(500,500);
	    w.focus();
    }
    //resizeTo(width,height)设置窗口的位置
    function setlocation(){
	    w.moveTo(200,200);
	    w.focus(); 
    }
    //关闭窗口
    function closewin(){
	    w.close();
    }
</script>
</head>
<body>
<p id="demo"></p>
<input type="button" value="Open Window" onclick="openwin()" />
<input type="button" value="setloc Window" onclick="setlocation()" />
<input type="button" value="setsize Window" onclick="setSize()" />
<input type="button" value="Close Window" onclick="closewin()" />
</body>
<script>
//window.innerWidth - 浏览器窗口的内部宽度
var w=window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
//window.innerHeight浏览器窗口的内部高度
var h=window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
x=document.getElementById("demo");
x.innerHTML="Browser inner window width: " + w + ", height: " + h + ".";
</script>
</html>