使用 jquery 在模型弹出窗口中打开新页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7291485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
open new page in model popup with jquery
提问by jenifer
Any one have idea how to open a new page in model popup using jQuery. New page should be Aspx page. I do not want use ajax extender.
任何人都知道如何使用 jQuery 在模型弹出窗口中打开一个新页面。新页面应该是 Aspx 页面。我不想使用 ajax 扩展程序。
回答by Sahil Muthoo
You could use a jQuery UI Dialog.
您可以使用jQuery UI Dialog。
$('#dialog').load('/path/to/aspx', function() {
$(this).dialog({
modal: true,
height: 200
});
});
This will load
the page at /path/to/aspx
in a div with id dialog
and then present the contents of the div in a modal window.
这将load
在/path/to/aspx
带有 id 的 div 中显示页面,dialog
然后在模态窗口中显示 div 的内容。
Include the following in your html
在您的 html 中包含以下内容
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
See the linked documentationfor more information.
有关更多信息,请参阅链接的文档。
回答by evotopid
Instead of jQuery UI Dialog, you could use the FaceboxPlugin. It's a very cool plugin and easy to use. Here a simple step by step instruction:
您可以使用Facebox插件代替 jQuery UI 对话框。这是一个非常酷的插件并且易于使用。这里有一个简单的分步说明:
- Put all the required links into the head part of your webpage, it's explained on their webpage.
Than you'll have to add this piece of code somewhere on your Webpage, best in the head:
jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() })
If you did this, you can just insert HTML links like this:
<a href="somepage.aspx" rel="facebox">Link Title</a>
- 将所有必需的链接放入网页的头部,在他们的网页上有说明。
比你必须在你的网页上的某个地方添加这段代码,最好在头脑中:
jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() })
如果你这样做了,你可以像这样插入 HTML 链接:
<a href="somepage.aspx" rel="facebox">Link Title</a>
I hope that helps you.
我希望这对你有帮助。