Click to See Complete Forum and Search --> : How can you put multiple javascripts on one document?


lightingbird
01-03-2004, 03:36 PM
I am trying to put in two different java codes and for some reason they wont work together.

1. They both have three parts

2. They both have a bodyonloader

3. They both have a code that goes in the body.

Any help????:(

geoserge
01-03-2004, 04:35 PM
you need some basic js tutorials. take a look at www.webmonkey.com (http://www.webmonkey.com) they have all you need to get you running.

idiotsoftcorp
01-03-2004, 04:38 PM
If they have the same variables then they wont work tried that?Just put all of the onload handlers on.Put the body scripts in separate tags.

lightingbird
01-03-2004, 04:54 PM
Seperate tags?

Do you mean for example this:

<html>
<head>
</head>
<body onloader 1>
<body onloader 2>
<body>
code 1
</body>
<body>
code 2
</body>
</html>

DanThMan
01-03-2004, 05:32 PM
Place this in your headsection
<script language="JavaScript">
function LoadFuncs() {
FUNCTION #1
FUNCTION #2
FUNCTION #3
</script>
FUNCTION #1 is what is inside of the quotation marks in the <body onLoad="FUNCTION #1"> command. Same with FUNCTION #2. And so on

place this as your body startsection.
<body onLoad="LoadFuncs()">

and don't add any more <body>! If you can't get this to work
try the safeaddonloadscript at

http://javascript.about.com/library/scripts/blsafeonload.htm

lightingbird
01-03-2004, 05:35 PM
Lovely.

Ill try it shortly.

Thanks.