Click here to get back home

How to format two "Body Onload" commands?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to format two "Body Onload" commands? Viken Karaguesian 03-18-2005
Get Chitika Premium
Posted by Viken Karaguesian on March 18, 2005, 6:46 am
Please log in for more thread options


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.



Posted by me on March 18, 2005, 9:03 am
Please log in for more thread options


> 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.

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




Posted by me on March 18, 2005, 9:52 am
Please log in for more thread options


> > 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.
>
> Have you asked your question in comp.lang.JavaScript, if not I recommend
you
> enquire there too.
> Signed,
> me

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




Posted by Steve Pugh on March 18, 2005, 2:57 pm
Please log in for more thread options



>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()">

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



Posted by Martin Honnen on March 18, 2005, 3:56 pm
Please log in for more thread options




Viken Karaguesian wrote:


> 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?

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/


Similar ThreadsPosted
Re: is invalid html 4 strict? June 21, 2008, 1:43 pm
Re: is invalid html 4 strict? June 21, 2008, 6:15 pm
I thought it was "impossible" to precisely dictate image position with html commands? October 3, 2004, 10:41 am
BODY DIR=LTR March 7, 2006, 9:01 am
mailto: and URL in body April 21, 2005, 11:30 am
Bad HTML tag format August 1, 2006, 11:33 am
Entering . to format January 5, 2008, 6:19 pm
question about the BODY tag in the HTML DTD April 8, 2008, 3:36 pm
set size of body in pixels July 27, 2008, 7:03 pm
date format in forms? July 15, 2004, 12:54 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap