PDA

View Full Version : Invoking Behavior on open


jmf
12-31-2006, 02:16 AM
Is there anyway to trigger a behavior when web a page opens? It is easy for a visitor to invoke a behavior by clicking on a mapped portion of the page once someone opens the page, but I cannot figure out how to start a behavior when the page is starting up.

jmf

domedia
12-31-2006, 10:43 AM
In javascript you can use onLoad to trigger a function when the page loads. You can use this in the body tag.

jmf
12-31-2006, 08:39 PM
How do you pick the behavior you want to run onload? The don't have names. The one I want to run is not even available from the page that I wish to invoke it from.

jmf

davidj
01-01-2007, 12:34 AM
hi jmf

in code view find the body tag and add...

<body onLoad="xxx"

NOTE: xxx is the function or action you want to call

what are you wanting to trigger

jmf
01-01-2007, 03:16 AM
That worked, but only when I'm using the Firefox browser; not with Explorer, Safari or SunriseBrowser.

Try it yourself: www.bodyelectrictv.com

jmf

davidj
01-01-2007, 11:27 AM
its a nice site. I like it

you have 2 body tags!!!

one at the top of the page

<body onLoad="MM_showHideLayers(

then one below your CSS

<body onLoad="MM_preloadImages(

jmf
01-01-2007, 04:23 PM
Bingo, and thank you Davidj (domedia too). A nice site is better when it works.

jmf

davidj
01-01-2007, 05:59 PM
err woah!!!!! I just did a view source on your site!!!

Your missing the basics big time and i know why. You have spent 100% in design view and the remainder in code view. You have used all your energy learning Dreamweaver when you should have been learning and understanding HTML and Javascript.

you need to understand HTML basics and rethink this site from the ground up. You have massive unnecessary V scrolling which i though was the effect of a rogue or broken table or a div but was suprised to find bad code all over the place. You have a <body tag incorrectly placed and you have made up your own tag called an <onLoad tag!!!! ?? You have 3 -4 <script blocks containing dreamweaver javascript which is intersected with CSS. I counted 3 <style tags!

you need to rethink your site and start learning HTML

you cannot release this to a client and except money for it in this condition!

jmf
01-01-2007, 08:32 PM
Thanks again Davidj,

I guess this is what happens when you rely on wizardry. A long time ago (maybe 20 years), I used nothing but html. When I returned, I was pleased to find tools like Dreamweaver, but now I am finding its limitations. The bad code was produced by relying on Dreamweaver plugins and behaviors. I really appreciate the fact that your criticism contained specific examples that I can repair.

jmf

jmf
01-01-2007, 09:04 PM
I couldn't find the made up body tag you mentioned. Are you looking at the source code in all pages or just the default page? I know it is not recommended, but I have been trying to transition this site rather than build it from scratch. The site was originally designed in cold fusion 20 years ago (by another developer) and those pages are still on the site (accessible but most are no longer available from the current navigation). Yet, there are some and this does junk up the site. It may be some of these pages that you have discovered errors.

jmf

davidj
01-01-2007, 09:15 PM
i like dreamweaver and use it myself proffessionally. It can save allot of time and effort if used correctly but if relied on completly then thats where you start to see the cracks appearing.

when i use a wizard or an extension i always look to see the code its written then i always find a better way or a neater way to do the same thing. The secret is to be able to read and understand what dreamweaver writes and what i see when using its built-in code is the equivalent of using a chain-gun to shoot rats! Yeah you might get a few but look at the mess your left with!

jmf
01-01-2007, 10:06 PM
I cannot disagree.

BTW, is there a way (or maybe a utility) that would show all links that navigable (accessible) following links and menus?

jmf

davidj
01-02-2007, 06:20 AM
see fig1 and fig2 below

jmf
01-02-2007, 02:54 PM
I was aware of that option in Dreamweaver, what I was looking for was a way to separate the grain from the shaft. SiteCleaner seems to be designed for this purpose but it crashes.

I know we've wandered off topic, but another thing that I can't seem to do is sort files by date while in the unexpanded file list. I can do this when using the Windows version, and on the Mac version when viewing the list in the expanded window. Thanks.

jmf