...

View Full Version : Multiple Javascripts



Flumoxed
12-07-2004, 02:33 PM
Hi,

I'm trying to add more than two Javascripts to one page.
I have the following instructions but I really can't figure them out....

Example of how to place more than one script on a webpage.

Script 1 <body onload="dothis()">
Script 2 <body onload="dothat()">

Resolve by typing..<body onload=dothis();dothat()>

Could anyone help me by converting these instructions into newbies language.

I'd be very grateful for help.

Many thanks.
F.

jbot
12-07-2004, 04:34 PM
<body onload=dothis();dothat()>

if you wrote proper HTML you wouldn't have a problem. you must always use quotations around attribute values. thus you should have written:


<body onload="dothis();dothat()">

Philip M
12-07-2004, 08:49 PM
You say "more than two" JavaScripts. That is no problem.

<body onload="dothis(); dothat(); dothethirdthing(); dothefourththing()">

where of course dothis() etc. are replaced by the names of the functions
you wish to call.

Bear in mind that names of functions and variables must not be duplicated, so if (for example) two or more scripts have a (global) variable named x then mayhem is likely to occur. In other words, you may need to rename certain functions and/or variables.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum