【发布时间】:2018-05-28 19:42:09
【问题描述】:
我有一个简单的 HTML (Home.html),它有一个 iframe。这个iframe 用于显示页面Grid.aspx。一切正常,但我的组织不允许在此项目中使用 iframe。管理安装 IIS 的服务器的 IT 部门不希望我使用它们。
我可以改用div 或其他元素吗?
这是我的 html,其中包含我需要替换的 IFrame,以及我用来在该 IFrame 中加载内容的当前 JavaScript:
<html class="no-js" lang="">
<head>
</head>
<body>
<div id="storeTable" style="width: 900px; height: 200px;">
<iframe id="retailframe" src="" width="900px" height="800px" scrolling="no" allowTransparency="true" frameborder="0" ></iframe>
</div>
<input type="button" value="Capacity Chart" onclick="CapacityChart();">
<script>
function CapacityChart()
{
var doc = document.getElementById('retailframe').contentWindow.document;
doc.open();
doc.write('Test');
doc.close();
var storeSite = "http://10.12.34.83:88/Grid.aspx";
var store = document.getElementById('retailframe');
store.src = storeSite;
}
</script>
</body>
</html>
如何将 Grid.aspx 的内容加载到 div 中?
【问题讨论】:
标签: javascript html css iframe