首页 新闻 会员 周边 捐助

window.open

0
悬赏园豆:5 [已解决问题] 解决于 2014-01-29 11:50

用window.open打开窗口为什么在一些浏览器里面都变成打开一个新的标签页,有没有什么好的方法打开窗口然后不会变成标签页的,我试过用window.showModalDialog,但在一些浏览器里面根本就打不开,请问还有没有其他好的办法呢?谢谢!

巴拉比巴拉的主页 巴拉比巴拉 | 初学一级 | 园豆:140
提问于:2013-10-22 14:57
< >
分享
最佳答案
0

window.open ([URL [, name [, features [, replace]]]]);

第二个参数name可以是_blank, _parent, _self, _top和自定义名字。你可借助这个参数来实现。

具体可参考:http://help.dottoro.com/ljuhanvh.php

URL
         
Optional. String that specifies the location of the document to load. Use the 'about:blank' value to open an empty document.
name
         
Optional. String that specifies the name of the new window, or specifies the target window where the document needs to be opened.
One of the following values:
_blank
         
The document needs to be opened into a new window. The name of the new window is an empty string initially.
_media
         
7        
The document needs to be opened in the Media Bar. This value is no longer supported by Internet Explorer. Do not use it!
_parent
         
The document needs to be opened in the parent window of the current frame. If the current window has no parent, the document will be opened in the current window.
_search
         
7        
The document needs to be opened in the Search Pane. The Search Pane is disabled in Internet Explorer from version 7. Do not use this value!
_self
         
The document needs to be opened in the current window.
_top
         
The document needs to be opened in the topmost ancestor window in the window hierarchy. If the current window has no parent, the document will be opened in the current window.
name
         
A string that specifies the initial name for the new window.
In Internet Explorer, the value must not contain spaces. The name of windows can be used to identify them.
When a new window needs to be opened with a specified name and a window opened by the current document already exists with the same name, then the browser uses the existing window, instead of creating a new one.
For further details, please see the page for the name property.
收获园豆:5
暝愁人 | 菜鸟二级 |园豆:209 | 2013-10-23 16:16
其他回答(5)
0

window.open基本所有的浏览器都支持这个方法,但是window.showModalDialog则可能只有ie才支持。其实现在流行的一种作法就内嵌层窗口

食神网技术 | 园豆:202 (菜鸟二级) | 2013-10-22 15:18
0

window.open 行为是可以通过浏览器设置更改的,因此,用户像要改为新标签,那就是新标签,这你没办法的。

换个做法吧,如楼上说的,新建一个弹出层。

飞扬的尘埃 | 园豆:1318 (小虾三级) | 2013-10-22 16:04
0

所以你能提供一个浏览器给客户,你可以实现这个效果。这个是受限于浏览器的,控制不了哦。

幻天芒 | 园豆:37207 (高人七级) | 2013-10-22 16:24
0

各种box满天飞的时代,用弹出层吧

空明流光 | 园豆:111 (初学一级) | 2013-10-23 13:04
0

自己解决了,用zDialog

巴拉比巴拉 | 园豆:140 (初学一级) | 2013-10-27 13:22
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册