Validation hint for Javascript with markup in it

Validation time. (For clients!) Get the stuff valid, so the work with CSS is less guess and more science. So, one begins by removing all the errors that have to do with missing slashes, lost ALT attributes, and soon the errors are fewer.

I had trouble with a piece of Javascript that wrote the markup for a chunk of Flash. It just used document.write() statements to write to the page, and the markup was given as an argument. I tried to wrap the code section in a CDATA section (the “right way” to do it), but IE found that erroneous. And being nice to IE was what this thing was all about, so I took another route.

My tactics were: “Perhaps the markup in the write statements could be divided, so the W3 Validator didn’t recognize it as markup.” That way worked.

W3 Validator gives warnings

I got off with a warning this time.

Published by olleolleolle

Olle is a programmer, enjoying sunny Malmö in Sweden.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.