我使用以下示例在我的网站上的iframe中显示网站。我使用以下代码:
$(document).ready(function() {
$('a#verd').click(function(e) {
e.preventDefault();
var $this = $(this);
var horizontalPadding = 30;
var verticalPadding = 30;
$('<iframe id="externalSite" class="externalSite" src="' + this.href + '" />').dialog({
title: ($this.attr('title')) ? $this.attr('title') : 'External Site',
autoOpen: true,
width: 800,
height: 500,
modal: true,
resizable: true,
autoResize: true,
overlay: {
opacity: 0.5,
background: "black"
}
}).width(800 - horizontalPadding).height(500 - verticalPadding);
});
....
});
....它与示例中的代码完全相同,但它对我不起作用。然而触发点击事件,我用警报测试它。任何想法都错了吗?
编辑:
我的网站结构
<html><head>
<script type="text/javascript" src="/js/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/js/frontend.js"></script>
<script type="text/javascript" src="/js/jquery.corner.js"></script>
<script type="text/javascript">
//<!--
$(document).ready(function() {
$('a#beginning').click(function() { $.post('/programme/list/page/1', {"format":"json"}, function(data, textStatus) { displayProgramms(data); }, 'html');return false; });
$('a#end').click(function() { $.post('/programme/list/page/11', {"format":"json"}, function(data, textStatus) { displayProgramms(data); }, 'html');return false; });
});
//-->
</script></head>
<body>
<div id="container">
<div id="header">
<div id="logo">
</div>
</div>
<div id="navholder">
...
</div>
<div id="contentwrapper" class="frontpage">
....
</div>
<div id="sidewrapper">
...
</div>
<div id="footerwrapper">
...
</div>
<div id="disclaimer">
...
</div>
</div>
</body></html>
js代码位于frontend.js
答案 0 :(得分:0)
答案 1 :(得分:0)
试试这个:
$('a#verd').click(function(e) {
e.stopPropagation();
var self = $(this),
horizontalPadding = 30,
verticalPadding = 30,
dtitle = $(this).attr('title')) ? $(this).attr('title') : 'External Site';
$('<iframe id="externalSite" class="externalSite" src="' + this.href + '" />').dialog(
{
title: dtitle,
autoOpen: true,
width: 800,
height: 500,
modal: true,
resizable: true,
autoResize: true,
overlay: {
opacity: 0.5,
background: "black"
}
}
).width(800 - horizontalPadding).height(500 - verticalPadding);
return false;
});
??? 你在叫jquery ui吗?