test.php
复制代码代码如下:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // pt" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-bransitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-language" content = "utf-8" />
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<meta name = "autor" content = "武林网 (myz)" />
<meta name = "copyright" content = "武林网 (myz)" />
<meta name = "description" content = "" />
<meta name = "Palavras -chave" Content = "" />
<link rel = "icon" href = "" tipo = "imagem /x-icon" />
<link rel = "Shortcut icon" href = "" type = "imagem /x-icon" />
<link href = "" rel = "stylesheet" type = "text /css" />
<Title> </title>
<script type = "text/javascript">
<!-
função winopen ()
{
window.open ("test2.php", "", "altura = 400, largura = 400");
}
->
</script>
</head>
<Body>
<textarea id = "text1" name = "text1"> </sexttarea>
<input type = "button" value = "enviar" name = "enviar" onclick = "javascript: winopen ();" />
</body>
</html>
</body>
</html>
test2.php
复制代码代码如下:
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // pt" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-bransitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-language" content = "utf-8" />
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<meta name = "autor" content = "武林网 (myz)" />
<meta name = "copyright" content = "武林网 (myz)" />
<meta name = "description" content = "" />
<meta name = "Palavras -chave" Content = "" />
<link rel = "icon" href = "" tipo = "imagem /x-icon" />
<link rel = "Shortcut icon" href = "" type = "imagem /x-icon" />
<link href = "" rel = "stylesheet" type = "text /css" />
<Title> </title>
<script type = "text/javascript">
<!-
função winback ()
{
if (window.opener) {
fwindowText1 = window.opener.document.getElementById ("text1");
fwindowText1.value = fwindowText1.value + "Mayongzhan";
window.close ();
}
}
->
</script>
</head>
<Body>
<input type = "button" name = "back" value = "back" onclick = "javascript: winback ();" />
</body>
</html>
window.open 详解
Window.open ("Surl", "Sname", "SFeature", "Breplace");
surl: 可选项。字符串 (string) 。指定要被加载的 html 文档的 url 地址。假如无指定值 , 则 sobre: em branco 的新窗口会被显示。
SNAME: 可选项。字符串 (String) 。指定打开的窗口的名字。这个名字可以用于 Formulário 或 A 对象的 Target 属性。此名字也可以使用下列通用名称: _media: ie6.0 在浏览器左边的媒体面板内打开 Surl。
_blank: 在新窗口中打开 Surl。
_parent: 在当前框架的父框架内打开。假如当前框架无父框架 , 此参数值等同于 _elf。
_search: ie5.0 在浏览器左边的搜索面板内打开 surl。
_self: surl 在当前窗口中打开 , 覆盖当前文档。
_top: 在所有框架之外的最顶层窗口中打开 Surl 。假如当前窗口无框架结构 , 此参数值等同于 _self。
SFEATURES: 可选项。字符串 (String) 。指定窗口装饰样式。使用下面的值。多个之间用逗号隔开。只有当新的浏览器窗口被建立时 , 此参数的设置才会发生作用。 ChannelMode = {Sim | Não | 1 | 0} 指定是否将窗口显示为频道模式。默认值为 Não。
diretórios = {sim | não | 1 | 0} 指定是否显示「链接」按钮。默认值为 Sim。
tela cheia = {sim | não | 1 | 0} 指定是否以全屏方式显示窗口。默认值为 no 。要小心使用全屏模式 , 因为这种模式会隐藏浏览器窗口的标题栏和菜单。如果没有在页面内提供关闭窗口的功能 , 用户可以使用 alt+f4 快捷键关闭窗口。
altura = número 设置窗口的高度。最小值为 100。
Esquerda = número 设置窗口左上角相对于桌面的横坐标。单位为像素 (px)。
largura = número 设置窗口的宽度。最小值为 100。
top = número 设置窗口左上角相对于桌面的纵坐标。单位为像素 (px)。
Localização = {Sim | Não | 1 | 0} 设置是否显示浏览器窗口的地址栏。默认值为 Sim。
Menubar = {Sim | Não | 1 | 0} 设置是否显示浏览器窗口的菜单栏。默认值为 Sim。
redimensionável = {sim | não | 1 | 0} 设置窗口是否允许被用户改变尺寸。默认值为 Sim。
scrollbars = {sim | não | 1 | 0} 设置窗口是否可以具有滚动条。默认值为 sim。
status = {sim | não | 1 | 0} 设置是否显示浏览器窗口的状态栏。默认值为 Sim。
titlebar = {sim | não | 1 | 0} 设置是否显示浏览器窗口的标题栏。除非调用程序是 html 应用程式 (hta) 或被信任的对话框 , 否则此参数将被忽略。默认值为 sim。 barra de ferramentas = {sim | não | 1 | 0} 设置是否显示浏览器窗口的工具条。默认值为 Sim。
Breplace: 可选项。布尔值 (booleano) 。false | true。false: 新打开的文档覆盖历史列表里的当前文档。 True: 文新打开的文档被简单的添加到历史列表的最后。
返回值
Onewwindow: 对象 (elemento) 。返回对新的 Janela 对象的引用。
说明
打开新窗口并载入 Surl 指定的 html 文档。默认情况下 , 此方法建立的新窗口具有默认的高度、宽度 , 以及菜单、工具条等。您可以使用 sFeatures 参数改变它们的设置。
当 SFEATURES 参数被指定时 , 没有在参数值的列表中出现的装饰样式都会被自动设置为 NO。
IE5+中允许控制打开的窗口的标题栏。通过在被信任的程序像 Microsoft?接口。
当文档内的对象上的事件 (Evento) 激发的函数调用 Abra 方法时 , Janela 对象的 Abra 方法被使用。而当文档内的对象上的事件 (Evento) 直接使用 Abra 方法时 , Documento 对象的 Abra 方法被使用。