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

标签 jquery jquery-ui

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

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

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

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

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

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

最佳答案

这应该有帮助。看 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

以下是传递给 window.open() 的一些常见属性:

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

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

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

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

  5. 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.).

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

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

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

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

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

关于jquery - 如何使用 jQuery UI 对话框单击打开一个新的浏览器窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14879585/

相关文章:

javascript - 对具有固定位置值的 DOM 元素进行排序(例如 : left:20px)

javascript - jQuery Sortable - 取消并恢复未按预期工作

jquery-ui - 将参数传递给 jquery ui 对话框

jquery - jQuery Greedy Droppable Dialog 可能吗?

javascript - jQuery Accordion 如果 hasClass

javascript - 我如何在这个ajax代码中选择第二个输入

javascript - 显示同位素图像所需的建议加载更多功能

jquery - 在图像 css 上显示图像

javascript - JQuery datepicker - 更改日期格式

javascript - Jquery 选项卡 : change ajax data on tab click