There are two reasons why multiple scripts in the same page will not work together.
a) duplicate global variable and/or function names (including loop counters etc.)
b) multiple onload statements.
Have a look at:-
http://www.javascriptkit.com/javatut...iplejava.shtml
http://www.dyn-web.com/tutorials/combine.php
Or you can simply fire a set of functions when the page loads (even if there is only one script - unobtrusive js - rather than <body onload = ...)
<script type="text/javascript">
window.onload = function() {
functionOne();
functionTwo();
}
</script>
document.write() is in effect obsolete. document.write() statements must be run before the page finishes loading. Any document.write() statement that runs after the page finishes loading will create a new page
and overwrite all of the content of the current page (including the Javascript which called it).
So document.write() is at best really only useful to write the original content of your page.
It cannot be used to update the content of your page after that page has loaded.
Jesus saves, Moses invests, Allah protects, and Cthulhu thinks you'd make a nice sandwich.