Why document.writeln is considered bad practice
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"><<CRIPT><!-- document.writeln(document.lastModified) --></SCRIPT></A>
was change 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.
- Adding URLs to sitemap.txt
- More examples of adding eventlisteners
- Why is document.write considered a bad practice? - 🔗 - StackExchange
Is write(ln) bad? - January 2021