javascript在关闭html标签后读取html评论

lap*_*sus 7 html javascript jquery dom

我知道在关闭'html'标签后你不应该放任何东西.告诉SharePoint它...

[...]
</body>
</html><!-- Rendered using cache profile:Public Internet (Purely Anonymous) at: 2013-06-06T12:57:10 -->
Run Code Online (Sandbox Code Playgroud)

这就是SharePoint输出缓存调试信息的样子.我希望这个隐藏的评论在每个页面上都可见.切换到源视图并转到文件末尾会让我感到厌倦.

为了不重新发明轮子,我认为将一段javascript代码添加到我的母版页是最明智的选择,该代码将评论复制到我选择的位置(页面内).

关于如何通过javascript获取评论的任何想法?jquery还可以.

xec*_*xec 2

简单地document.lastChild.nodeValue就能解决问题。

(假设你在 DOM 准备好后运行它)

编辑

我擅自修改了未定义答案中的代码:)

$(function(){
    $('body').append(document.lastChild.nodeValue);
});
Run Code Online (Sandbox Code Playgroud)

http://jsbin.com/arodiz/3/edit