## Running Two Scripts

This page is an example of how you can run two scripts with the onLoad function at the same time. It is a seperate script that loads the two scripts. I took these two scripts from my page. They are the Digital Clock script and the Status Bar Scroller script. I know a lot of you asked for this, so here it is.

- The first thing that you should do is to copy the information that goes into your `<head></head>` tag.
- Second, copy any other information that should go into the body of your document.

Now, the script that loads the other scripts goes in the `<head></head>` tag as well.

    <script language="JavaScript">
    function LoadFuncs() {
       FUNCTION #1
       FUNCTION #2
    </script>

FUNCTION #1 is what is inside of the quotation marks in the <body onLoad="FUNCTION #1"> command. Same with FUNCTION #2.
In this example "FUNCTION #1" is "startclock()" and "FUNCTION #2" is "timerONE=window.setTimeout('scrollit(100)',500)"
You may also use more then two scripts, just add another function to this part of the script.
This is an example of what my function looks like.
``

    function LoadFuncs() {
       startclock()
       timerONE=window.setTimeout('scrollit(100)',500)
    }

Now to start these scripts running, you need to put this line in your `<body>` tag.

    onLoad="LoadFuncs()"

For example, mine looks like this
`<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#000080" ALINK="#000080" onLoad="LoadFuncs()">`
I hope this helps!

This is what my entire script looks like. I pulled this info straight from my page.

<html> <head> <title>Running Two Scripts</title> <script language="JavaScript"> function LoadFuncs() { startclock() timerONE=window.setTimeout('scrollit(100)',500) } <!-- Hide the script from old browsers -- var timerID = null; var timerRunning = false; var id,pause=0,position=0; function stopclock (){ if(timerRunning) clearTimeout(timerID); timerRunning = false; } function showtime () { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds() var timeValue = "" + ((hours >12) ? hours -12 :hours) timeValue += ((minutes < 10) ? ":0" : ":") + minutes timeValue += ((seconds < 10) ? ":0" : ":") + seconds timeValue += (hours >= 12) ? " P.M." : " A.M." document.clock.face.value = timeValue; timerID = setTimeout("showtime()",1000); timerRunning = true; } function startclock () { stopclock(); showtime(); } // --End Hiding Here --> </script> <script language="JavaScript"> <!-- Hide the script from old browsers -- function scrollit(seed) { var m1 = " THIS IS WHERE YOUR MESSAGE GOES "; var msg=m1; var out = " "; var c = 0; if (seed > 100) { seed--; var cmd="scrollit(" + seed + ")"; timerTwo=window.setTimeout(cmd,7); } else if (seed <= 100 && seed > 0) { for (c=0 ; c < seed ; c++) { out+=" "; } out+=msg; seed--; var cmd="scrollit(" + seed + ")"; window.status=out; timerTwo=window.setTimeout(cmd,7); } else if (seed <= 0) { if (-seed < msg.length) { out+=msg.substring(-seed,msg.length); seed--; var cmd="scrollit(" + seed + ")"; window.status=out; timerTwo=window.setTimeout(cmd,7); } else { window.status=" "; timerTwo=window.setTimeout("scrollit(100)",75); } } } // --End Hiding Here --> </script> </head> <body BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#000080" ALINK="#000080" onLoad="LoadFuncs()"> </body> </html>