Window.open

来源:互联网 发布:用友t3软件多少钱 编辑:程序博客网 时间:2024/06/15 18:26
参数:

sUrl : 可选项。字符串(String)。指定要被加载的HTML文档的 URL 地址。假如无指定值,则 about:blank的新窗口会被显示。sName : 可选项。字符串(String)。 指定打开的窗口的名字。这个名字可以用于 form 或 a对象的 TARGET 属性。此名字也可以使用下列通用名称:_media : IE6.0在浏览器左边的媒体面板内打开 sUrl _blank :  在新窗口中打开 sUrl _parent :  在当前框架的父框架内打开。假如当前框架无父框架,此参数值等同于 _self _search : IE5.0在浏览器左边的搜索面板内打开 sUrl _self :  sUrl 在当前窗口中打开,覆盖当前文档。_top :  在所有框架之外的最顶层窗口中打开 sUrl 。假如当前窗口无框架结构,此参数值等同于 _self sFeatures : 可选项。字符串(String)。 指定窗口装饰样式。使用下面的值。多个之间用逗号隔开。只有当新的浏览器窗口被建立时,此参数的设置才会发生作用。channelmode = { yes | no | 1 | 0 }  指定是否将窗口显示为频道模式。默认值为 no directories = { yes | no | 1 | 0 }  指定是否显示「链接」按钮。默认值为 yes fullscreen = { yes | no | 1 | 0 }  指定是否以全屏方式显示窗口。默认值为 no 。要小心使用全屏模式,因为这种模式会隐藏浏览器窗口的标题栏和菜单。如果没有在页面内提供关闭窗口的功能,用户可以使用 ALT+F4 快捷键关闭窗口。height = number  设置窗口的高度。最小值为 100 left = number 设置窗口左上角相对于桌面的横坐标。单位为像素( px )。width = number  设置窗口的宽度。最小值为 100 top = number 设置窗口左上角相对于桌面的纵坐标。单位为像素( px )。location = { yes | no | 1 | 0 }  设置是否显示浏览器窗口的地址栏。默认值为 yes menubar = { yes | no | 1 | 0 }  设置是否显示浏览器窗口的菜单栏。默认值为 yes resizable = { yes | no | 1 | 0 }  设置窗口是否允许被用户改变尺寸。默认值为 yes scrollbars = { yes | no | 1 | 0 }  设置窗口是否可以具有滚动条。默认值为 yes status = { yes | no | 1 | 0 }  设置是否显示浏览器窗口的状态栏。默认值为 yes titlebar = { yes | no | 1 | 0 }  设置是否显示浏览器窗口的标题栏。除非调用程序是HTML应用程式( HTA )或被信任的对话框,否则此参数将被忽略。默认值为 yestoolbar = { yes | no | 1 | 0 }  设置是否显示浏览器窗口的工具条。默认值为 yes bReplace : 可选项。布尔值(Boolean)。false | truefalse : 新打开的文档覆盖历史列表里的当前文档。true : 文新打开的文档被简单的添加到历史列表的最后。


a.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <title>a.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">--><script type="text/javascript">function selectKeHu(){window.open("b.html","_blank","height=200,width=400,status=no,toolbar=no,menubar=no,location=no");}function addValue(value){document.getElementById("userName").value = value;}</script>  </head>    <body>    选择客户<input type="text" name="userName" onclick="selectKeHu()" id="userName">  </body></html>

b.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <title>b.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">--><script type="text/javascript">function change(value){window.opener.addValue(value);//获得a.html的引用,再调用a,html中的函数}</script>  </head>    <body>    <table>    <tr>    <td>法师</td>    <td><input type="button" value="选择" onclick="change('法师')"></td>    </tr>    <tr>    <td>萨满</td>    <td><input type="button" value="选择" onclick="change('萨满')"></td>    </tr>    </table>  </body></html>



原创粉丝点击