Metachecker.net
|
FontsMadeEasy.com
|
RankChecker.net
Learn Java Script Today
|
Over 5000 Free Fonts
|
Tutorials
|
Javascript Forum
|
Other Javascript Resources
|
Cheat Sheet
JavaScript Basics
Inserting Javascript
Complete Tutorial
Advance DHTML Tutorial
Script archive
Advanced Tutorials
Alert Scripts
Animation
Audio
Background Effects
Banner Ads
Browser Window
Buttons
Button Forms
Calculcators
Calendars
Clocks & Dates
Cookies
Cursor Effects
DHMTL Games
DHTML Miscellaneous
Equivalents
Forms
Games
IE4+ Scripts
IE5+ Scripts
Image Effects
Image Miscellaneous
Links & Buttons
Math Related
Messages Miscellaneous
Miscellaneous
Mouse Tricks
Navigation
Page Details
Password Protection
Pulldown Menus
Random Stuff
Scrolling
Status Bar
Text Animation
User Detail
User Info
Window Control
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.
Insert into <HEAD>
<script language="JavaScript"> function LoadFuncs() { FUNCTION #1 FUNCTION #2 </script>
Insert into <BODY>
onLoad="LoadFuncs()"
Other Options
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 it 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 an example what the entire script looks like. <HTML> <HEAD> <TITLE></TITLE> <script language="JavaScript"> function LoadFuncs() { startclock() timerONE=window.setTimeout('scrollit(100)',500) } </script> <script language="JavaScript"> <!-- 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()"> <CENTER><form name="clock" onSubmit="0"> <input type="text" name="face" size=13 value=""></CENTER><BR>