E
e271828
I've got a way to get all of the source HTML for a given page by line
and detect where certain attributes exist, and I would like to write
the line of HTML code I've been working on into a new window. Right
now, the code looks something like this
---
function validate() {
// gets the HTML source of the document and splits it by line.
var allLines = document.documentElement.innerHTML.split('/n');
for (n=0;n<allLines.length;n++) {
// looks for opening tags, looks for STYLE attribute.
var openingTag = allLines[n].match(/</gi);
var styleAttribute = allLines[n].match(/style/gi);
if (openingTag && styleAttribute) {
// gives the line number, (n+1) and the HTML source ofline that has an
opening tag and //STYLE attribute. This works (even if this code I
wrote in 2 minutes has errors)
alert((n+1) + allLines[n]);
//Instead of an alert box, I'd like to write it to a document in a new
window. Unfortunately this //writes the output of the HTML (as if it
were a visual fragment of the page), not the HTML //source as I would
like. The line number shows up fine, but no source.
var newwindow = window.open('',errorwindow,iforget);
newwindow.document.write((n+1) + allLines[n]);
document.close;
}}}
and detect where certain attributes exist, and I would like to write
the line of HTML code I've been working on into a new window. Right
now, the code looks something like this
---
function validate() {
// gets the HTML source of the document and splits it by line.
var allLines = document.documentElement.innerHTML.split('/n');
for (n=0;n<allLines.length;n++) {
// looks for opening tags, looks for STYLE attribute.
var openingTag = allLines[n].match(/</gi);
var styleAttribute = allLines[n].match(/style/gi);
if (openingTag && styleAttribute) {
// gives the line number, (n+1) and the HTML source ofline that has an
opening tag and //STYLE attribute. This works (even if this code I
wrote in 2 minutes has errors)
alert((n+1) + allLines[n]);
//Instead of an alert box, I'd like to write it to a document in a new
window. Unfortunately this //writes the output of the HTML (as if it
were a visual fragment of the page), not the HTML //source as I would
like. The line number shows up fine, but no source.
var newwindow = window.open('',errorwindow,iforget);
newwindow.document.write((n+1) + allLines[n]);
document.close;
}}}