<INPUT type="button" class="MyButton" onClick="openwindow2('<%=url%>','',700, 800)" value="打印信息">
<INPUT type="button" class="MyButton" onClick="history.back();" value="返 回">
function openwindow2(url,name,iWidth,iHeight){
var url; //转向网页的地址;
var name; //网页名称,可为空;
var iWidth; //弹出窗口的宽度;
var iHeight; //弹出窗口的高度;
var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置;
var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置;
window.open(url,name,'height='+iHeight+',innerHeight='+iHeight+',
width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=yes,resizeable=no,location=no,status=no');
}
window.open
window.open ("page.html", "newwindow", "height=100, width=400, toolbar= no, menubar=no, scrollbars=no, resizable=no, location=no, status=no,top=100,left=300")
height:page.html的高度
width:page.html的宽度
top:page.html距离屏幕顶部的距离
left:page.html距离屏幕左边的距离
top和left就是给page.html设定位置的
window.open() 方法
语法:window.open(pageurl,name,parameters);
window对象的open()方法用于创建一个新的窗口实例,
新创建的窗口的外观由参数:parameters指定。
新窗口中打开的文档由参数: pageurl指定。
系统能够根据参数:name确定的名称访问该窗口。
下表为parameters参数表:
参数 衩始值说明
alwaysLowered yes/no 指定窗口隐藏在所有窗口之下。
alwaysRaised yes/no 指定窗口浮在所有窗口之上。
dependent yes/no 指定打开的窗口为父窗口的一个子窗口。并随父窗口的关闭而关闭。
directions yes/no 指定Navigator 2和3的目录栏是否在新窗口中可见。
height pixel value 设定新窗口的像素高度。
hotkeys yes/no 在没有菜单栏的新窗口设置安全退出热键。
innerHeight pixel value 设置新窗口中文档的像素高度。
innerWidth pixel value 设置新窗口中文档的像素宽度。
location yes/ no 指明地址栏在新窗口中是否可见。
menubar yes /no 指明菜单栏在新窗口中是否可见。
outerHeight pixel value 设定窗口(包括装饰边框)的像素高度。
outerWidth pixel value 设定窗口(包括装饰边框)的像素宽度。
resizable yes /no 指明新窗口是否可以调整。
screenX pixel value 设定新窗口离屏幕边界的像素长度。
screenY pixel value 设定新窗口离屏幕上边界的像素长度。
scrollbars yes /no 指明滚动栏在新窗口中是否可见。
status yes /no 指明状态栏在新窗口中是否可见。
titlebar yes /no 指明菜单题目栏在新窗口是否可见。
toolbar yes /no 指明工具栏在新窗口中是否可见。
Width pixel value 设定窗口的像素宽度。
z-look yes /no 在文档中包含各个 <pplet>标签的数组。
fullscreen yes / no 打开的窗体是否进行全屏显示
left pixel value 设定新窗口距屏幕左方的距离
top pixel value 设定新窗口距屏幕上方的距离
例子:
<html>
<head>
<title>window.open函数 </title>
</head>
<body>
<script language="javascript">
<!--
window.open("","name1","width=100,height=200,toolbar=no,scrollbars=no,menubar=no,screenX=100,screenY=100");
//-->
</script>
</body>
</html>