Re: OT - Quick Javascript question

by "Beauford.2002" <beauford.2002(at)rogers.com>

 Date:  Sat, 18 Jan 2003 21:23:54 -0500
 To:  "Ten-Zero Webmaster" <webmaster(at)ten-zero.net>,
<hwg-basics(at)hwg.org>
 Cc:  "Greg Hart" <ghhart(at)earthlink.net>
 References:  p1 zero
  todo: View Thread, Original
Ok, Got it. Between yourself and Greg I figured it out....Thanks

<SCRIPT language=javaScript>
function loadboth() {
 blurtext()
 init();monitor=document.getElementById('mon')
 }
</SCRIPT>

<BODY onload="loadboth()">


----- Original Message -----
From: "Ten-Zero Webmaster" <webmaster(at)ten-zero.net>
To: <hwg-basics(at)hwg.org>
Cc: "Beauford.2002" <beauford.2002(at)rogers.com>
Sent: Saturday, January 18, 2003 8:02 PM
Subject: Re: OT - Quick Javascript question


> Beauford.2002 wrote:
>
> > I have two scripts which require to be loaded in the <body section of my
> > html page using onload=, but it appears you can only have one of these
> > at a
> > time - as I am not familiar with javascripts is there a way I could have
> > more than one onload=?
> >
> > Thanks, Beauford
> >
> > i.e <BODY onload="something" onload="somthingelse">
> >
> Yep, there are two way most people handle this problem.
>
>
> 1. putting them both in the '|onLoad'| attribute separated by a semicolon:
>
> <BODY /onLoad="alert('Hello There!'); alert('Howdy!')"/>
>
> 2. If you want to run more than two commands, just put semicolons in
> between all the commands. However, this tends to get messy, so it's
> usually a good idea to put the commands in a single function and call
> the function from |onLoad|. So, for example, you could create a function
> called '|init()'| by putting this script in the |<HEAD>| section of your
> page:
>
> <SCRIPT TYPE="text/javascript"> function init() { alert('Hello There!');
> alert('Howdy!'); } //--> </SCRIPT>
>
> Then you can call |init()| with this |onLoad| attribute:
>
> <BODY /onLoad="init()"/>
>
> M.
>
>
>

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA