【发布时间】:2011-11-15 20:46:20
【问题描述】:
以下页面在 JQuery 对话框中显示了一个 iFrame。这是一个完整的工作页面,您可能只需要修复顶部的 jQuery 和样式表引用。我在 Visual Studio 的 ASP.NET MVC3 项目中创建它...
<!DOCTYPE html>
<html>
<head>
<title>Dialog Test</title>
<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
<script type="text/javascript">
function showDialog() {
$("#divId").dialog({
title: 'Test Dialog',
resizable: false,
modal: false,
height: 500,
width: 500
});
$("#myFrame").attr("src", "http://www.google.com");
return false;
}
</script>
</head>
<body>
<a href="" onclick="return showDialog();">Show Dialog</a>
<div id="divId" style="display: none;">
<iframe id="myFrame" name="myFrame" width="100%" height="100%" frameborder="1" scrolling="auto" />
</div>
</body>
</html>
此代码在 Internet Explorer 中运行没有问题,但在 Chrome 和 FireFox 中无法运行。 iFrame 加载,但它只是空的。请帮忙。我将不胜感激任何提示/建议。
【问题讨论】:
标签: jquery firefox google-chrome iframe dialog