有时候需要在一个页面上,点击一个连接或是按钮,弹出另外一个窗口(大小和位置可以指定),并且传递相关的参数。这里有两个页面实现

     第一个页面aa.html

<html>
<head>
<title>aa</title>
<script language="javascript">
function openNewWindow(sip){
var parm="邹腾";
     var url = "bb.html?ip="+sip+"&parm="+parm;
     
/*
window.screen.availWidth 返回当前屏幕宽度(空白空间)
window.screen.availHeight 返回当前屏幕高度(空白空间)
window.screen.width 返回当前屏幕宽度(分辨率值)
window.screen.height 返回当前屏幕高度(分辨率值)
window.document.body.offsetHeight; 返回当前网页高度
window.document.body.offsetWidth; 返回当前网页宽度

Window.Open参数、返回值
脚本运行后,bb.html将在新窗体中打开,宽为500,高为400,距屏顶h象素,屏左w象素,无工具条,无菜单条,无滚动条,不可调整大小,无地址栏,无状态栏
*/


     var w=window.screen.availWidth-500;
     var h=window.screen.availHeight-400;
     window.open (url, '', "top="+h+", left="+w+", width=500, height=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");
}
</script>

</head>
<body>
这是aa.html页面
<input type="button"  value="提交0" onclick="openNewWindow('192.168.1.1')"/>
</body>
</html>
aa.html

相关文章: