--- www/ie/iemenu/show-comment.html 2002/03/30 13:47:56 1.1.1.1 +++ www/ie/iemenu/show-comment.html 2002/03/31 04:45:19 1.1.1.1.2.1 @@ -24,24 +24,41 @@ for (var i = 0; i < head.all.length; i++) { var el = head.all(i); if (el.tagName == "!") { - var ot = el.text; - ot = ot.replace(/&/g,'&'); - ot = ot.replace(//g,'>'); + var ot = replace_specials (el.text); itext += '
' + ot + '
'; + } else if (el.tagName == "SCRIPT") { + var ot = replace_specials (el.outerHTML); + itext += '
' + ot + '
'; + } else if (el.tagName == "STYLE") { + var ot = replace_specials (el.outerHTML); + itext += '
' + ot + '
'; } } // comments after start tag of BODY element for (var i = 0; i < doc.body.all.length; i++) { var el = doc.body.all(i); if (el.tagName == "!") { - var ot = el.text; - ot = ot.replace(/&/g,'&'); - ot = ot.replace(//g,'>'); + var ot = replace_specials (el.text); ot = ot.replace(/ /g,'  '); el.outerHTML = '' + ot + ''; - i += 2; + i += 1; + } else if (el.tagName == "SCRIPT") { + var ot = replace_specials (el.outerHTML); + ot = ot.replace(/ /g,'  '); + el.outerHTML = '' + ot + ''; + i += 1; + } else if (el.tagName == "NOSCRIPT" + || el.tagName == "NOFRAMES" /* instead of IFRAME */ + || el.tagName == "NOEMBED" /* non-standard */ + ) { + var ot = replace_specials (el.outerHTML); + el.outerHTML = '' + ot + ''; + i += 1; + } else if (el.tagName == "COMMENT") { /* IE extension */ + var ot = replace_specials (el.outerHTML); + ot = ot.replace(/ /g,'  '); + el.outerHTML = '' + ot + ''; + i += 1; } } // insert comments before BODY element @@ -49,6 +66,12 @@ itext = '' + itext + ''; doc.body.all(0).outerHTML = itext + doc.body.all(0).outerHTML; } +function replace_specials (rt) { + rt = rt.replace(/&/g,'&'); + rt = rt.replace(//g,'>'); + return rt; +}