Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 24th, 2005, 12:52 AM
Viken Karaguesian
Guest
 
Posts: n/a
Default How to format two "Body Onload" commands?

Hello all,

I have a question. I trying to run two Javascripts on my webpage, both
of which need a <body onload> command. They are as follows:

<body onload="runMe()">
<body onload="SwapImgs()">

What would be the proper format to include these on the same line?
would it be:

<body onload="runMe(),SwapImgs()">
or
<body onload="runMe()";"SwapImgs()">

I'd like to get these working together and at the moment, I can't.
Thanks in advance for your replies.

Viken K.

  #2  
Old July 24th, 2005, 12:52 AM
Martin Honnen
Guest
 
Posts: n/a
Default Re: How to format two "Body Onload" commands?



Viken Karaguesian wrote:

[color=blue]
> I have a question. I trying to run two Javascripts on my webpage, both
> of which need a <body onload> command. They are as follows:
>
> <body onload="runMe()">
> <body onload="SwapImgs()">
>
> What would be the proper format to include these on the same line?[/color]

Use
<body onload="runMe(); SwapImgs();">
a sequence of statements in JavaScript is separated by a semicolon.

You could also write a function calling those other functions e.g.
<script type="text/javascript">
function init () {
runMe();
SwapImgs();
}
</script>

<body onload="init();">
--

Martin Honnen
http://JavaScript.FAQTs.com/
  #3  
Old July 24th, 2005, 12:52 AM
Steve Pugh
Guest
 
Posts: n/a
Default Re: How to format two "Body Onload" commands?

"Viken Karaguesian" <vikenk@aol.com> wrote:
[color=blue]
>I have a question. I trying to run two Javascripts on my webpage, both
>of which need a <body onload> command. They are as follows:
>
><body onload="runMe()">
><body onload="SwapImgs()">
>
>What would be the proper format to include these on the same line?
>would it be:
>
><body onload="runMe(),SwapImgs()">
>or
><body onload="runMe()";"SwapImgs()">[/color]

Close.
<body onload="runMe();SwapImgs()">

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
  #4  
Old July 24th, 2005, 12:52 AM
me
Guest
 
Posts: n/a
Default Re: How to format two "Body Onload" commands?

"Viken Karaguesian" <vikenk@aol.com> wrote in message
news:1111153562.722494.298270@g14g2000cwa.googlegr oups.com...[color=blue]
> Hello all,
>
> I have a question. I trying to run two Javascripts on my webpage, both
> of which need a <body onload> command. They are as follows:
>
> <body onload="runMe()">
> <body onload="SwapImgs()">
>
> What would be the proper format to include these on the same line?
> would it be:
>
> <body onload="runMe(),SwapImgs()">
> or
> <body onload="runMe()";"SwapImgs()">
>
> I'd like to get these working together and at the moment, I can't.
> Thanks in advance for your replies.
>
> Viken K.[/color]

Have you asked your question in comp.lang.JavaScript, if not I recommend you
enquire there too.
Signed,
me


  #5  
Old July 24th, 2005, 12:52 AM
me
Guest
 
Posts: n/a
Default Re: How to format two "Body Onload" commands?

"me" <anonymous@_.com> wrote in message
news:113lnu3qg7o6s1b@corp.supernews.com...[color=blue]
> "Viken Karaguesian" <vikenk@aol.com> wrote in message
> news:1111153562.722494.298270@g14g2000cwa.googlegr oups.com...[color=green]
> > Hello all,
> >
> > I have a question. I trying to run two Javascripts on my webpage, both
> > of which need a <body onload> command. They are as follows:
> >
> > <body onload="runMe()">
> > <body onload="SwapImgs()">
> >
> > What would be the proper format to include these on the same line?
> > would it be:
> >
> > <body onload="runMe(),SwapImgs()">
> > or
> > <body onload="runMe()";"SwapImgs()">
> >
> > I'd like to get these working together and at the moment, I can't.
> > Thanks in advance for your replies.
> >
> > Viken K.[/color]
>
> Have you asked your question in comp.lang.JavaScript, if not I recommend[/color]
you[color=blue]
> enquire there too.
> Signed,
> me[/color]

Corruption by spell checker encountered. Here's the correct name of that NG:
comp.lang.javascript
Signed,
me


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles