This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > February 2004 > how to have more than 1 "onLoad" action





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author how to have more than 1 "onLoad" action
ThomasWaters

2004-02-14, 10:28 am

My current web pages have an onLOad action to p-reload the images. This was
done automatically when DW lbi's were added to a page. But I need to add a
javascript manually that will collect the screen size and window size of the
site visitor. How do I manually adjust the onLoad so that the current onLoad
callls the needed javascript? Do I add code to one of the javascripty that
calls the other javascript? Can anyone tell me how to do that

th

current: <body onLoad="MM_preloadImages(....

needed: <BODY onload="whenReady()"


Ken Ford - PVII Support

2004-02-14, 10:28 am

Just add a semi-colon:

<body onload="whenReady();MM_preloadImages(...."

--
Ken Ford
Certified Dreamweaver MX 2004 Developer
PVII Support Team
http://www.projectseven.com


"ThomasWaters" <rxweb@pitt.edu> wrote in message news:c0l8i8$qf$1@forums.macromedia.com...
> My current web pages have an onLOad action to p-reload the images. This was
> done automatically when DW lbi's were added to a page. But I need to add a
> javascript manually that will collect the screen size and window size of the
> site visitor. How do I manually adjust the onLoad so that the current onLoad
> callls the needed javascript? Do I add code to one of the javascripty that
> calls the other javascript? Can anyone tell me how to do that
>
> th
>
> current: <body onLoad="MM_preloadImages(....
>
> needed: <BODY onload="whenReady()"
>
>



Ross Riley

2004-02-14, 11:28 am

There's two ways to do this
Firstly you can separate commands by a semicolon, ie: onLoad="command1;
command2;
Or you can have an onLoad function which includes all your commands and just
call that in the onLoad command

Ros

Joe Makowiec

2004-02-14, 11:28 am

On 14 Feb 2004 in macromedia.dreamweaver, ThomasWaters wrote:

> My current web pages have an onLOad action to p-reload the images.
> This was done automatically when DW lbi's were added to a page. But
> I need to add a javascript manually that will collect the screen
> size and window size of the site visitor. How do I manually adjust
> the onLoad so that the current onLoad callls the needed javascript?
> Do I add code to one of the javascripty that calls the other
> javascript? Can anyone tell me how to do that
>
> th
>
> current: <body onLoad="MM_preloadImages(....
>
> needed: <BODY onload="whenReady()"


Ken Ford's reply is quite correct; however, it gets to be a problem
when you have a whole bunch of things to do onload. (Of course, if it
gets to that point, I'd think about what I was trying to do with all
that javascript, but that's another discussion...)

In a <script> tag or in your external javascript file:

function whenReady() {
MM_preloadImages(...);
myOtherScript();
PVII_script();
....
}
....
<BODY onload="whenReady();" ...>

--
Joe Makowiec can be reached at:
http://makowiec.org/contact/?Joe
ThomasWaters

2004-02-14, 8:28 pm

Thanks. So, if I wan to try the second approach, how to proceed. It seems tro
me that what you are saying is that the onLoad command calls a script, and all
the actions I want done are a part of that script. so, I would take both
javascripts and combine them into one, yes

I'm going to try the first approach now, in that that seems pretty simple


Ken Ford - PVII Support

2004-02-14, 9:28 pm

Why take away the functionality of using Behaviors in DW?

--
Ken Ford
Certified Dreamweaver MX 2004 Developer
PVII Support Team
http://www.projectseven.com


"voivoda" <vmarthirial@hotmail.com> wrote in message news:c0mhi4$drc$1@forums.macromedia.com...
> BTW, those are not commands, are functions and when you use the behaviors
> included in DW, the software creates a very hard to translate JavaScript that
> will be triggered by the onLoad event. My suggestion is that you create a big
> function with two more functions inside, the preloader and the resizing one.
> You can get pre-made functions for this needs from several websites
> (javascript.com, web monkey, etc
>



voivoda

2004-02-14, 9:28 pm

BTW, those are not commands, are functions and when you use the behaviors
included in DW, the software creates a very hard to translate JavaScript that
will be triggered by the onLoad event. My suggestion is that you create a big
function with two more functions inside, the preloader and the resizing one.
You can get pre-made functions for this needs from several websites
(javascript.com, web monkey, etc

Mick White

2004-02-14, 9:28 pm

Why bother? There's no advantage one way or the other.
Mick


voivoda wrote:

> BTW, those are not commands, are functions and when you use the behaviors
> included in DW, the software creates a very hard to translate JavaScript that
> will be triggered by the onLoad event. My suggestion is that you create a big
> function with two more functions inside, the preloader and the resizing one.
> You can get pre-made functions for this needs from several websites
> (javascript.com, web monkey, etc
>

ThomasWaters

2004-02-15, 10:28 am

Thanksfor clarifying functions as opposed to commands. The js I need to add
isn't a resize, but captures the viewers screen size and window size so that
the log stats software can tabulate that data

What makes me reluctant is where placing a .lbi (I use them ALOT) on the page
automatically puts the image preload js in the page. So, is there a way to
stop that from happening, or a way to customize the js it places to also
include the other stuff I need

Are you suggesting the "onLoad="command1; command2;"" won't work, or just
pointing out that "command" wasn't really the correct word to use there

Murray *TMM*

2004-02-15, 11:28 am

Thomas:

Library items should not contain <html>, <head>, or <body> tags. If they
do, then you have made it improperly.

Since a Library item cannot contain any of these elements, it should also
not contain javascript or embedded (or linked) stylesheets. To do so will
lead to trouble.

Finally, if the Library item cannot contain any of this, then it cannot know
that you are doing a preload, hence it cannot trigger DMX to add that js to
the receiving page, so you should be off the hook, so to speak.

Also, if you use Library items alot, then you should investigate either
templates (more flexible by far) or SSI (more convenient by far).

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
news://forums.macromedia.com/macromedia.dreamweaver - THE BEST WAY TO GET
ANSWERS
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"ThomasWaters" <rxweb@pitt.edu> wrote in message
news:c0nvlv$q8r$1@forums.macromedia.com...
> Thanksfor clarifying functions as opposed to commands. The js I need to

add
> isn't a resize, but captures the viewers screen size and window size so

that
> the log stats software can tabulate that data
>
> What makes me reluctant is where placing a .lbi (I use them ALOT) on the

page
> automatically puts the image preload js in the page. So, is there a way

to
> stop that from happening, or a way to customize the js it places to also
> include the other stuff I need
>
> Are you suggesting the "onLoad="command1; command2;"" won't work, or just
> pointing out that "command" wasn't really the correct word to use there
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews