我想通过 javascript 在 div 中加载一个包含 2 个框架的 html 页面。 我在 div 中加载 html 资源的代码是
Util.importResource("my_div_id", 'docs/admin/index.html');
加载div资源的函数。
Util={
importResource: function(divId, resourcePath, appender) {
$("div#" + divId).load(resourcePath, function(resp, stat, req) {
if(req.status <= 0 || req.status >= 400) {
window.location.reload();
return;
}
if (typeof(appender) != "undefined" && appender != null)
{
resp += appender;
$("div#" + divId).append(appender);
}
});
},
但该特定页面未显示在 div 中,其余纯 html 页面加载正常。 我的 Html 页面看起来像
<html>
<head>
<title>asd</title>
</head>
<frameset cols="20%,*" style="border:0px solid #000000; background-color:#ffffff;" frameborder="1">
<frame name="toclist" title="content" src="toc.html" scrolling="auto"></frame>
<frame name="bsscright" title="page" src="hr/title_page.html" scrolling="auto"></frame>
</frameset>
</html>
任何人都可以帮我解决这个问题吗?
最佳答案
我想你想追加 resp + appender
。
....
if (typeof(appender) != "undefined" && appender != null)
{
resp += appender;
$("div#" + divId).append(resp );
}
else{
$("div#" + divId).append(resp );
}
.....
关于javascript - 使用包含框架的 html 页面加载 Div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12832534/