Java script and validator... not the common endtag/backslash error


I have javascript which has writeln() statements and
validator parses the content of the script. javascript
is used to generate whole pages and it also generates
more javascript. I get this kind of errors:

invalid comment declaration: found delimiter "'"
outside comment but inside comment declaration

d.writeln( '<!--' );
character "<" is the first character of a delimiter
but occurred as data

d.writeln( ' if (selection < images.length - 1) {' );
document type does not allow element "body" here

+ '<body onkeypress="javascript:getKey();">'

and lots of more.

I know I can skip these by putting the script in
separate file, but I can't do that since my PHP
gerates the javascript. so I have PHP which generates
javascript which generates javascript.

Is there any other way to do it so that validator
don't parse inside javascript?

Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.

Received on Saturday, 21 August 2004 16:43:20 UTC