javascript中window.open()的用法及参数设置-Ball

window.open() //及点击打开新页

window.open('src','newwindow','attr') //可代参3个。

  src:新建页面文件地址;

  newwindow:弹出窗口名(非文件名)可为空;

  attr:height=100 窗口高度; 
     width=400 窗口宽度; 
     top=0 窗口距离屏幕上方的象素值; 
     left=0 窗口距离屏幕左侧的象素值; 
     toolbar=no 是否显示工具栏,yes为显示; 
     menubar,scrollbars 表示菜单栏和滚动栏。 
     resizable=no 是否允许改变窗口大小,yes为允许; 
     location=no 是否显示地址栏,yes为允许;

     可为空(为空时且为浏览器默认模式)。

js部分全参数模式:

window.open ('page.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')

精简封装模式:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>window.open</title>
<script>
function alertNewPage(osrc)
{
window.open(osrc);
}
</script>
</head>
<body>
<input type="button" value="弹出" onclick="alertNewPage('http://www.imtaih.com/')"/>
</body>
</html>



                                                   希望可以帮助大家解决问题 ^_^ ~

posted @ 2011-11-11 14:18  志宝[Ball]  阅读(465)  评论(0)    收藏  举报