我使用jquery对话框在模式对话框中显示html文件:
主站点调用test.html:
<body>
<div id="layer" style="display: none;">
</div>
</body>
<script type="text/javascript">
$("#layer").dialog({
dialogClass: 'noTitleStuff',
autoOpen: false,
position : ['center',20],
/*draggable: false, */
resizable : true,
modal : true,
show : 'fade',
hide : /*'drop'*/'fade',
width: 'auto',
heigth: 'auto',
open: function() {
$(".ui-dialog-titlebar").removeClass('ui-widget-header');
},
});
$( function() {
$("#layer").load('test.php', function() {
$("#layer").dialog("open");
});
});
</script>
这可以很好地工作,并且可以很好地显示test.php的内容。但是当我在test.php中点击一个链接时,这个链接会在整个浏览器窗口中打开。如何在对话框中显示新站点?
谢谢你的帮忙
发布于 2013-11-27 04:51:56
将新url的内容加载到对话框。
$(function(){
$(document).on("click", ".yourLinkCssClassName", function (e) {
e.preventDefault();
$.get($(this).attr("href"), function (data) {
$("#layer").html(data);
});
});
});
https://stackoverflow.com/questions/20227601
复制相似问题