Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine 2 onload functions in the body tag

Status
Not open for further replies.

JoJoH

Programmer
Joined
Jan 29, 2003
Messages
356
Location
US
How do you combine 2 onload function in the body tag?

Thanks in advance
 
Code:
function doLoad(){
  onload1();
  onload2();
}
</script>
<body onload=&quot;doLoad()&quot;>

-pete
 
Hi Pete,

Like this?

<script language=&quot;JavaScript&quot;>
function doBoth()
{
runSlideShow();
writemenus();
}

</script>

<BODY onLoad=&quot;doboth()&quot;>

If yes, it is not working correctly, maybe I did something wrong? Please advice.
 
<script language=&quot;JavaScript&quot;>
function doBoth()
{
alert(&quot;in doBoth&quot;);
runSlideShow();
writemenus();
}

add that. If the alert pops up then your problem is in one or both of the other functions yes?

-pete
 
I just did, and it is doing what it was doing before I added the alert function: It popped out a error dialog box saying:

ine 371
Object expected


I am not sure why but Line 371 is a bracket...

<script language=&quot;JavaScript&quot;>
function doBoth()
{ <-----------------------------------------Line 371
runSlideShow();
writemenus();
}

</script>
 
why bother with a function to call two other functions?

<body onload=&quot;runSlideShow();writemenus()&quot;>

Why not that way? Gary Haran
 
you have tested each function separately yes?

Code:
<body onload=&quot;runSlideShow()&quot;>

and then

Code:
<body onload=&quot;writemenus()&quot;>

-pete
 
Thanks guys for all your help, I have already got it figured out, thanks again! [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top