list.html
未加载。这是加载html文件的正确方法吗?
<div id="subscription"> </div>
<script>
var i;
for (i = 0; i < 5; i++) {
document.getElementById("subscription").innerHTML = '<object type="text/html" data="list.html"></object>'
}
</script>
答案 0 :(得分:1)
你不能使用:
<object type="text/html" data="list.html" ></object>
最佳建议可能是使用<iframe>
s:
<div id="subscription"> </div>
<script>
var i;
for (i = 0; i < 5; i++) {
document.getElementById("subscription").innerHTML = '<iframe src="list.html"></iframe>';
}
</script>
但不确定为什么需要循环5次。你可以这样做:
<div id="subscription"> </div>
<script>
document.getElementById("subscription").innerHTML = '<iframe src="list.html"></iframe>';
</script>