| re: document.write-ing some innerHTML to a new window
The actual code is the first section of code below. It will properly
bring up an alert box with any line of source that has a tag with a
STYLE attribute, and the line number of that particular element. What
I need, though, is for that information to be written to a document in
a new window. I've included a version of what I need, in case anyone
can suggest how that can be done.
---
Brings up an alert box with the source and line number:
function linenumber() {
var allLineNumbers = document.documentElement.innerHTML.split("\n");
for (var n=0;n<allLineNumbers.length; n++) {
allTags1 = allLineNumbers[n].match(/<[a-z].*/gi);
allTags2 = allLineNumbers[n].match(/style.*/gi);
if(allTags1&&allTags2){
alert((n+1)+allLineNumbers[n]);
}}}
---
Brings up new window and writes one of the line numbers, but not the
source:
function linenumber() {
var allLineNumbers = document.documentElement.innerHTML.split("\n");
for (var n=0;n<allLineNumbers.length; n++) {
allTags1 = allLineNumbers[n].match(/<[a-z].*/gi);
allTags2 = allLineNumbers[n].match(/style.*/gi);
if(allTags1&&allTags2){
errwin =
window.open('','errorwindow','width=525,height=375 ,scrollbars=yes');
errwin.document.write(n +allLineNumbers[n]);
errwin.document.close();
}}}
---
Thanks. |