test.php
复制代码代码如下:
<!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>
<メタhttp-equiv = "content-language" content = "utf-8" />
<Meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<Meta name = "author" content = "武林网(myz)" />
<Meta name = "Copyright" content = "武林网(myz)" />
<Meta name = "description" content = "" />
<Meta name = "keywords" content = "" />
<link rel = "icon" href = "" type = "image /x-icon" />
<link rel = "ショートカットアイコン" href = "" type = "image /x-icon" />
<link href = "" rel = "styleSheet" type = "text /css" />
<title> </title>
<script type = "text/javascript">
<! -
functionWinopen()
{
window.open( "test2.php"、 ""、 "height = 400、width = 400");
}
- >
</script>
</head>
<body>
<textarea id = "text1" name = "text1"> </textarea>
<入力型= "button" value = "submit" name = "submit" onclick = "javascript:winopen();" />
</body>
</html>
</body>
</html>
test2.php
复制代码代码如下:
<!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>
<メタhttp-equiv = "content-language" content = "utf-8" />
<Meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<Meta name = "author" content = "武林网(myz)" />
<Meta name = "Copyright" content = "武林网(myz)" />
<Meta name = "description" content = "" />
<Meta name = "keywords" content = "" />
<link rel = "icon" href = "" type = "image /x-icon" />
<link rel = "ショートカットアイコン" href = "" type = "image /x-icon" />
<link href = "" rel = "styleSheet" type = "text /css" />
<title> </title>
<script type = "text/javascript">
<! -
functionWinback()
{
if(window.opener){
fwindowtext1 = window.opener.document.getelementbyid( "text1");
fwindowtext1.value = fwindowtext1.value + "mayongzhan";
window.close();
}
}
- >
</script>
</head>
<body>
<入力型= "button" name = "back" value = "back" onclick = "javascript:winback();" />
</body>
</html>
window.open详解
window.open( "surl"、 "sname"、 "sfeature"、 "breplace");
surl:可选项。字符串(string)。指定要被加载的html
スナム:可选项。字符串(string)。指定打开的窗口的名字。这个名字可以用于form a对象的ターゲット属性。此名字也可以使用下列通用名称:_media:ie6.0在浏览器左边的媒体面板内打开surl。
_blank:在新窗口中打开surl。
_parent:在当前框架的父框架内打开。假如当前框架无父框架、此参数值等同于_ self。
_search:ie5.0
_self:surl在当前窗口中打开、覆盖当前文档。
_top:在所有框架之外的最顶层窗口中打开surl。假如当前窗口无框架结构、此参数值等同于_セルフ。
sfeatures:可选项。字符串(文字列)。指定窗口装饰样式。使用下面的值。多个之间用逗号隔开。只有当新的浏览器窗口被建立时、此参数的设置才会发生作用。 ChannelMode = {はい|いいえ| 1 | 0}
ディレクトリ= {はい|いいえ| 1 | 0}指定是否显示「链接」按钮。默认值为はい。
fullscreen = {yes | no | 1 | 0}指定是否以全屏方式显示窗口。默认值为no。要小心使用全屏模式、因为这种模式会隐藏浏览器窗口的标题栏和菜单。如果没有在页面内提供关闭窗口的功能、用户可以使用alt+f4快捷键关闭窗口。
高さ= number100。
左=番号设置窗口左上角相对于桌面的横坐标。单位为像素(px)。
width = number设置窗口的宽度。最小值为100。
top = number设置窗口左上角相对于桌面的纵坐标。单位为像素(px)。
場所= {はい|いいえ| 1 | 0}设置是否显示浏览器窗口的地址栏。默认值为はい。
menubar = {はい|いいえ| 1 | 0}设置是否显示浏览器窗口的菜单栏。默认值为はい。
resizable = {yes | no | 1 | 0}设置窗口是否允许被用户改变尺寸。默认值为はい。
scrollbars = {yes | no | 1 | 0}设置窗口是否可以具有滚动条。默认值为はい。
ステータス= {はい|いいえ| 1 | 0}设置是否显示浏览器窗口的状态栏。默认值为はい。
titlebar = {yes | no | 1 | 0}设置是否显示浏览器窗口的标题栏。除非调用程序是html应用程式(hta)或被信任的对话框、否则此参数将被忽略。默认值为はい。 Toolbar = {はい|いいえ| 1 | 0}设置是否显示浏览器窗口的工具条。默认值为はい。
ブレプレス:可选项。布尔值(ブール)。false|true。false:新打开的文档覆盖历史列表里的当前文档。true:文新打开的文档被简单的添加到历史列表的最后。
返回值:
onewwindow:对象(要素)。返回对新的ウィンドウ对象的引用。
说明:
打开新窗口并载入surl
当sfeatures参数被指定时、没有在参数值的列表中出现的装饰样式都会被自动设置为
IE5+中允许控制打开的窗口的标题栏。通过在被信任的程序像Microsoft?VisualBasic接口。
当文档内的对象上的事件(イベント)激发的函数调用オープン方法时、ウィンドウ对象的オープン方法被使用。而当文档内的对象上的事件(イベント)直接使用オープン方法时、ドキュメント对象的オープン方法被使用。