Thursday, 15 September 2011

dom - Is it possible to get reference to comment element/block by JavaScript? -


It seems a little crazy, but I'm wondering if it is possible to get the context of the comment element so that I can get it dynamically Can convert from other content to javascript

  & lt; Html & gt; & Lt; Top & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "header" & gt; & Lt; / Div & gt; & Lt; Div id = "content" & gt; & Lt; / Div & gt; & Lt ;! - Sidebar Place Holder: Some IDs - & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

In the above page, can I get reference block reference and replace it with some material in local storage?

I know that I can have a playwell hold holder just wondering if this comment applies to the block thank you.

var findcomments = function (el) {var arr = []; For (var i = 0; i & lt; el.childNodes.length; i ++) {var node = l. If (node.nodeType === 8) {arr.push (node); } Other {arr.push.apply (arr, findcomments (node)); }} Return arr; }; Var Comment Nodes = SearchComments (Documents); // whatever you were going to comment with ... console.log (commentNodes [0] .nodeValue);

No comments:

Post a Comment