Click to See Complete Forum and Search --> : simple question


Greelmo
05-18-2003, 07:36 PM
I want to have 2 different functions run when the body loads, so in the body tag, how do i script that?

brendandonhue
05-18-2003, 07:43 PM
<script language="javascript">
function func1()
{
blah
}
function func2()
{
blah
}
func1();
func2()
</script>

Greelmo
05-18-2003, 07:45 PM
thankyou much

AdamBrill
05-18-2003, 07:51 PM
Actually, you should do it like this:

<script language="javascript">
function func1()
{
blah
}
function func2()
{
blah
}
</script>

Then the <body> tag should look like this:

<body onload="func1(); func2();">

AdamBrill
05-18-2003, 08:42 PM
True, but from the wording of his original post, I assumed that he wanted it to run after the page was loaded. Greelmo, just so you know, my method will run right after the page loads, while brendandonhue's method will run as it is loading... Like Dave said, you should use the method that fits your needs... ;)

AdamBrill
05-19-2003, 09:05 AM
Originally posted by Dave Clark
You're right, I reread the original request and that would be an appropriate take on it. Hope I didn't step on any toes. :D
No way. :) I should have pointed out the difference anyway... ;)