javascript window.open()弹出窗口
时间:2010-03-03 来源:admin126com
javascript window.open()弹出窗口参数详解
<script type="text/javascript">
<!--
window.open ('test.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
//必须写成一行
-->
</script>
参数解释:
window.open 弹出新窗口的命令;
test.html 弹出窗口的文件名;
newwindow 弹出窗口的名字(不是文件名),非必须,可用空''代替;
height=100 窗口高度;
width=400 窗口宽度;
top=0 窗口距离屏幕上方的象素值;
left=0 窗口距离屏幕左侧的象素值;
toolbar=no 是否显示工具栏,yes为显示
menubar,scrollbars 表示菜单栏和滚动栏。
resizable=no 是否允许改变窗口大小,yes为允许
location=no 是否显示地址栏,yes为允许;
status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许
实例:
<!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=gb2312" />
<title>登录页</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script LANGUAGE="JavaScript">
<!--
function openwin(URL) {
window.open (URL, "newwindow", "height=800, width=500, toolbar =yes, menubar=yes, scrollbars=yes, resizable=yes, location=yes, status=yes") //写成一行
}
//-->
</script>
<div class="alltab">
<div class="tit">
<h3>系统入口</h3>
</div>
<div class="cont">
<table class="tab">
<tr>
<td>
<a href="#" onclick="openwin('http://www.sohu.com')" > <img src="images/w18w.gif" /><span>sohu</span></a>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>