如何使用jQuery UI对话框单击打开新的浏览器窗口?

问题描述:

我正在使用jquery UI对话框,并且有一些单选按钮和一个提交按钮.

I'm using the jquery UI dialog box, and I have some radio buttons and a submit button.

如果选择了第一个按钮,并且用户单击了该按钮,则我希望打开一个新窗口,就像有一个href标记一样:

If the 1st button is selected, and the user clicks the button, I want a new window to open just like if there was a href tag like:

<a href="http://www.example.com" target="_blank">Click</a>

到目前为止,在点击事件中,我位于:

So in the click event so far I am at:

$(this).click(function (e) {
   e.preventDefault();
});

是否可以这样做? (必须在IE中工作)

Is it possible to do this? (has to work in IE)

这对您有帮助.查看小提琴: http://jsfiddle.net/pcDbX/

This here should help. Look at the fiddle: http://jsfiddle.net/pcDbX/

$('#link').click(function () {

     window.open('http://www.example.com','mywindow','width=400,height=200')

});

此链接还将向您显示可以使用的参数: http://www.pageresource.com/jscript/jwinopen.htm

Also this link will show you what parameters you can use: http://www.pageresource.com/jscript/jwinopen.htm

这是传递给window.open()的一些常用属性:

And here are some common attributes to pass to the window.open():

  1. width = 300使用它来定义新窗口的宽度.

  1. width=300 Use this to define the width of the new window.

height = 200使用它来定义新窗口的高度.

height=200 Use this to define the height of the new window.

resizable = yes或no使用此选项来控制您是否希望用户能够调整窗口的大小.

resizable=yes or no Use this to control whether or not you want the user to be able to resize the window.

scrollbars =是或否这使您可以决定是否在窗口上具有滚动条.

scrollbars=yes or no This lets you decide whether or not to have scrollbars on the window.

toolbar =是或否新窗口是否应在顶部具有浏览器导航栏(后退,前进,停止 按钮等.)

toolbar=yes or no Whether or not the new window should have the browser navigation bar at the top (The back, foward, stop buttons..etc.).

location =是或否是否希望显示带有当前url的位置框(键入地址的位置).

location=yes or no Whether or not you wish to show the location box with the current url (The place to type the address).

directories = yes或no窗口是否应显示额外的按钮. (很棒的按钮,个人按钮等).

directories=yes or no Whether or not the window should show the extra buttons. (what's cool, personal buttons, etc...).

status =是或否是否在窗口底部显示窗口状态栏.

status=yes or no Whether or not to show the window status bar at the bottom of the window.

menubar =是或否是否在窗口顶部显示菜单(文件,编辑等...).

menubar=yes or no Whether or not to show the menus at the top of the window (File, Edit, etc...).

copyhistory =是或否是否将旧浏览器窗口的历史记录列表复制到新窗口.

copyhistory=yes or no Whether or not to copy the old browser window's history list to the new window.