我使用以下结构将完整的html(见下面的骨架)页面加载到另一个html页面中,点击按钮。
<!--START:HTML to be loaded by ajax-->
<head>
<!--START: The content inside this head tag is not processed while the page is loaded via ajax-->
<link rel="stylesheet" type="text/css" href="css/rrr.css" media="screen, projection, print" />
<script>
...
</script>
<script type="text/javascript" src="aaas/xxxx.js"></script>
<!--END: The content inside this head tag is not processed while the page is loaded via ajax-->
</head>
<div id="content">
<!--Page content on which the above script tags inside head tag to act-->
</div>
<!--END:HTML to be loaded by ajax-->
在safari版本5.0.1和5.0.2中,head标记内的内容未被解析,但html中的内容在所有IE,FF和chrome以及safari 5.1.2中被解析。 在id等于“content”的div中的内容在所有浏览器中显示,包括safari 5.0.1和5.0.2。 请帮帮我。谢谢。
答案 0 :(得分:0)
LINK元素只能用于文档的HEAD。
与A不同,它可能只出现在文档的HEAD部分, 虽然它可能会出现任何次数。
因此,您可以在iframe
(包含文档)中加载,但不能在div
内加载,但不符合规范的浏览器除外。
在您的情况下,最简单的解决方法可能是使用iframe
。请注意,css不适用于父文档。
答案 1 :(得分:0)
使用documentFragment to store the responseText,然后执行以下步骤:
head
代码