Creating a Multiple Script File
You might have a collection of scripts that you call from time to time, like a scripts which calculate time zones or distance, or maybe scripts that create some effect or accent on your page. For recurring Javascripts, consider grouping them together into one file.
For this example, name the group Javascripts file scriptfile.js (choose whatever you want) and say it contains the updatepage, emailpage, and caltimezone scripts. As you copy each Javascript into the file, make sure it has a unique function name such as with this condensed version:
function updatepage() {var m="Page updated "+document.lastMo.......} function emailpage() {mail_str = "mailto:?subject=....} function caltimezone() {var timerID ; function tzone(tz, os, ds, cl) {this.ct =......} Place the script file of all the Javascripts in the head of the header.php template file between the meta tags and the style sheet link. It will just sit there, loaded into the browser's memory, waiting for one of the scripts inside to be called.
<script type="text/javascript" src="/scripts/scriptfile.js"></script> In the spot in your post where you would like to use the Javascript, call it as follows:
<script type="text/javascript"> <!-- updatepage(); //--></script>