PDA

View Full Version : Running Onload


hari.kara
08-27-03, 09:55 AM
Can anyone tell me if there is any way of running two or more onload commands at the same time on a single page. And if there is can you show me or direct me in the right direction.

:confused:

Shane
08-28-03, 12:12 PM
Originally posted by hari.kara
Can anyone tell me if there is any way of running two or more onload commands at the same time on a single page. And if there is can you show me or direct me in the right direction.

:confused:


<html>
<head>
<title>Test</title>
<script language="javascript">
function cmdLoad() {

firstStep();

secondStep();


}

function firstStep() {


}

function secondStep() {


}
</script>
</head>
<body onload="cmdLoad()">

</body>
</html>

hari.kara
08-29-03, 10:54 AM
Thanks Shane,

Im assuming if i keep adding the classes ie third, fourth, i can run a fair few onloads at the same time?

Shane
08-29-03, 11:06 AM
Yup, that's correct.

I always did it that way because it's a lot easier to look at, unlike the inline version. (i.e onload="firstStep(); secondStep();")

hari.kara
08-29-03, 11:13 AM
Is there a limit to how many.. or are the constraints just the loading time...

Shane
08-29-03, 12:16 PM
I don't think there are any limits. It will just affect your loading time.

etLux
08-29-03, 12:43 PM
See also, here:

http://www.codelifter.com/main/tips/tip_002.shtml

hari.kara
09-01-03, 04:34 AM
Thanks EtLux an d Shane.. Problem solved!