Whoa, WHOA! It's not 1997 any more!
There is NO valid language attribute on the script element, don't use that!
Don't use document.write, it will not work with XHTML.
If you're using bad code it won't matter
how you implement something.
Keep all your scripting in a separate file. I keep two script files,
index.js and
onload.js. The index.js file changes rarely and has all the functions that I use in my work. The onload.js file contains the anonymous onload function (you can not have more than one instance of the onload event) and the file also contains global variables for user preferences that can change over the course of the time; if the user updates their preferences the much smaller onload.js file is forced to reload overriding the cache (onload.js?245425454 Unix date/time stamp).
You
really do not want to put
any other script elements on the page and the two I mentioned should be in the head element. If you want to force the page layout to finish before the script files are downloaded use the defer attribute.
<head>
<title>Example</title>
<script defer="defer" src="scripts/index.js" type="application/javascript"></script>
<script defer="defer" src="scripts/onload.js" type="application/javascript"></script>
</head>
Do this and you'll set yourself up for much more advanced stuff that will give you a LOT of freedom in the future should you choose to continue to refine your skill. In example my site loads on dial-up initially in ten seconds with each successive page load within two to three seconds. I've offloaded a lot of scripting for optional components that a small percentage of users actually use though I could not do this if I had poor or no coding practices.
Think standards first and then performance and if you also code server side code remember that a server's performance effects
every client. However at this point if you're posting code like that you really should focus on using better code. Lastly don't use the
innerHTML method which is akin to crowning a queen by throwing the crown at her face like a football. If you stick strictly to these practices you're going to go a lot further than you can imagine. :)
- John