alwaysLowered | yes/no | 指定窗口隐藏在所有窗口之后
alwaysRaised | yes/no | 指定窗口悬浮在所有窗口之上
depended | yes/no | 是否和父窗口同时关闭
directories | yes/no | Nav2和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 | 窗口是否可有滚动栏
titlebar | yes/no | 窗口题目栏是否可见
toolbar | yes/no | 窗口工具栏是否可见
Width | pixel value | 窗口的像素宽度
z-look | yes/no | 窗口被激活后是否浮在其它窗口之上
window = object.open([URL ][, name ][, features ][, replace>>)
URL:新窗口的URL地址
name:新窗口的名称,可以为空
featurse:属性控制字符串,在此控制窗口的各种属性,属性之间以逗号隔开。
fullscreen= { yes/no/1/0 } 是否全屏,默认no
channelmode={ yes/no/1/0 } 是否显示频道栏,默认no
toolbar={ yes/no/1/0 } 是否显示工具条,默认no
location= { yes/no/1/0 } 是否显示地址栏,默认no
directories = { yes/no/1/0 } 是否显示转向按钮,默认no
status= { yes/no/1/0 } 是否显示窗口状态条,默认no
menubar={ yes/no/1/0 } 是否显示菜单,默认no
scrollbars= { yes/no/1/0 } 是否显示滚动条,默认yes
resizable={ yes/no/1/0 } 是否窗口可调整大小,默认no
width=number窗口宽度(像素单位)
height=number 窗口高度(像素单位)
top=number窗口离屏幕顶部距离(像素单位)
left=number 窗口离屏幕左边距离(像素单位
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< html xmlns = " http://www.w3.org/1999/xhtml " >
< head >
< title > 创建窗口 </ title >
< meta http - equiv = " content-type " content = " text/html; charset=gb2312 " >
< script type = " text/javascript " >
<!--
function createFeatureString() // 函数:创建特征字符串
{
var featurestring = "" ;
var numelements = document.windowform.elements.length;
for (var i = 0 ; i < numelements; i ++ )
if ( (document.windowform.elements[i].type == " checkbox " ) &&
(document.windowform.elements[i]. checked ) )
featurestring += document.windowform.elements[i].name + " =yes, " ;
// 获取窗口大小及位置信息
featurestring += " height= " + document.windowform.height.value + " , " ;
featurestring += " width= " + document.windowform.width.value + " , " ;
featurestring += " top= " + document.windowform.top.value + " , " ;
featurestring += " left= " + document.windowform.left.value + " , " ;
featurestring += " screenx= " + document.windowform.screenX.value + " , " ;
featurestring += " screeny= " + document.windowform.screenY.value;
return featurestring; // 返回窗口特征字符串内容
}
function openWindow() // 函数:打开窗口
{ // 调用createFeatureString()获取特征字符串
var features = createFeatureString();
var url = document.windowform.windowurl.value; // 获取窗口URL
var name = document.windowform.windowname.value; // 获取窗口名称
theNewWindow = window.open(url,name,features); // 打开新窗口
if (theNewWindow)
// 打开新窗口
document.windowform.jscode.value =
" window.open(' " + url + " ',' " + name + " ',' " + features + " '); "
else
// 显示代码无效
document.windowform.jscode.value = " Error: JavaScript Code Invalid " ;
}
function closeWindow() // 函数:关闭窗口
{
if (window.theNewWindow) // 如果是新窗口
theNewWindow.close(); // 关闭窗口
}
// -->
</ script >
</ head >
< body >
< form name = " windowform " id = " windowform " action = " # " method = " get " >
< h2 > 基本属性 </ h2 >
URL地址: < input type = " text " name = " windowurl " id = " windowurl " size = " 30 " maxlength = " 300 " value = " http://www.yahoo.com.cn " >< br >
窗口名称: < input type = " text " name = " windowname " id = " windowname " size = " 30 "
maxlength = " 300 " value = " secondwindow " >< br >
< h2 > 大小 </ h2 >
高度: < input type = " text " name = " height " id = " height " size = " 4 " maxlength = " 4 " value = " 100 " >
宽度: < input type = " text " name = " width " id = " width " size = " 4 " maxlength = " 4 "
value = " 100 " >< br >
< h2 > 位置 </ h2 >
距顶部: < input type = " text " name = " top " id = " top " size = " 4 " maxlength = " 4 " value = " 100 " >
距左边: < input type = " text " name = " left " id = " left " size = " 4 " maxlength = " 4 " value = " 100 " > (IE) < br >< br >
ScreenX: < input type = " text " name = " screenX " id = " screenX " size = " 4 " maxlength = " 4 "
value = " 100 " >
ScreenY: < input type = " text " name = " screenY " id = " screenY " size = " 4 " maxlength = " 4 "
value = " 100 " > (Netscape) < br >
< h2 > 显示特征 </ h2 >
Always Lowered: < input type = " checkbox " name = " alwaysLowered " id = " alwaysLowered " >
Always Raised: < input type = " checkbox " name = " alwaysRaised " id = " alwaysRaised " >
Dependent: < input type = " checkbox " name = " dependent " id = " dependent " >
Directories: < input type = " checkbox " name = " directories " id = " directories " >
Hotkeys: < input type = " checkbox " name = " hotkeys " id = " hotkeys " >
Location: < input type = " checkbox " name = " location " id = " location " >
Menubar: < input type = " checkbox " name = " menubar " id = " menubar " >< br >
Resizable: < input type = " checkbox " name = " resizable " id = " resizable " >
Scrollbars: < input type = " checkbox " name = " scrollbars " id = " scrollbars " >
Titlebar: < input type = " checkbox " name = " titlebar " id = " titlebar " >
Toolbar: < input type = " checkbox " name = " toolbar " id = " toolbar " >
Z - Lock: < input type = " checkbox " name = " z-lock " id = " z-lock " >
< br >< br >
<!-- 通过onclick调用openWindow()函数和closeWindow()函数,用来打开和关闭窗口 -->
< input type = " button " value = " 创建窗口 " onclick = " openWindow(); " >
< input type = " button " value = " 关闭窗口 " onclick = " closeWindow(); " >
< br >< br >
< hr >
< h2 > JavaScript Window.open 语句 </ h2 >
< textarea name = " jscode " id = " jscode " rows = " 4 " cols = " 50 " ></ textarea >
</ form >
</ body >
</ html >