0

我试图通过 ajax 加载整个页面(删除了 doctype 和 html 标签)。接着

document.documentElement.innerHTML=xmlhttp.responseText;

但谷歌浏览器说:指定了无效或非法的字符串。

如果我这样做,同样的错误:

document.documentElement.innerHTML='<head><meta></head><body></body>';

但是这个字符串没关系:

document.documentElement.innerHTML='<head></head><body></body>';
4

1 回答 1

0

尝试这个:

document.write(xmlhttp.responseText);

当然,您需要包含 html 标记和 doctype。

于 2013-11-07T18:49:14.970 回答