Re: OT - Quick Javascript question

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

 Date:  Sat, 18 Jan 2003 21:10:51 -0500
 To:  "Ten-Zero Webmaster" <webmaster(at)ten-zero.net>
 Cc:  "HWG Basics" <hwg-basics(at)hwg.org>
 References:  p1 zero
  todo: View Thread, Original
Sounds good in theory, but nothing is ever that easy with me...lol. Here is
my body.....

<BODY onload="init();monitor=document.getElementById('mon')";
onload="blurtext()" LINK="#400040" VLINK="#400040" ALINK="#400040"
TEXT="#400040">

Whichever one I put first is the one that works. Note that the first one
calls an init() which is an init.js file.

</HEAD>

<style type="text/css" title="stylesheet.css">
 @import "menu.css";
</style>
<script src="menubarAPI4.js" type="text/javascript"></script>
<script src="init.js" type="text/javascript">
</script>

<SCRIPT language=javaScript>
        next script
</SCRIPT>

</HEAD>

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