Sun Dial Menu
write(ln)
Menu document.writeln
 

Why document.writeln is considered bad practice

When debugging JavaScript code on pages Console sometimes complains about the use of document.writeln().

I used this in my footer to echo the date and time that the page was last changed. I also don't know why the document.writeln() only works if it enclosed within comment code and on a new line.

The code that I changed:

<A HREF="#top"><SCRIPT><!--
    document.writeln(document.lastModified)
    --></SCRIPT></A>

was changed to:

<script> document.getElementById("code").innerHTML = document.lastModified; </script>

In addition if you click on the top-most code snippet it will change the section heading text. Also notice that the cursor will change to a pointer if placed over the snippet.

So why is it bad-practice?

In short - code injection.....

Last modified:-

Links

External Links Disabled.

tempusfugit.me.uk is a non-commercial website. No payment or benefit is gained by the placement of links toother websites.

The External link is disabled to on this page, please visit other pages

Unlike most genealogical research websites tempusfugit.me.uk does not attempt to get you to "sign-up" when you click on one of their links.

This Wikipedia link is disabled.

The link on Wikipedia was to:

External Links Disabled.

tempusfugit.me.uk is a non-commercial website. No payment or benefit is gained by the placement of links to other websites.

The External link is disabled to on this page, please visit other pages

Top

External Links - references

Site design by Tempusfugit Web Design -