View Full Version : Applying onLoad to body tag in template

08-23-2009, 09:06 PM

Iím brand new to Dreamweaver Club and brand new to web design, and thereís something I just canít figure out, even though Iíve read a bunch of web postings and even the manual. Can you help?

Basically, I created a website with Dreamweaver CS4 based on a template and Iím trying to make the body tag editable and apply the Appear/Fade behavior to the onload event for just one page. That is, after just one page loads (the Home page), I want an image to fade into view.

I know I need to select the body tag (itís actually body.layout) on the template and go to Modify -> Templates -> Make Attribute Editable, but then Iím not sure what to do. Iíve tried a bunch of things, updated the pages based on the template, and then gone to Modify -> Template Properties for the Home page, but I canít figure out how to apply the behavior using the Tag Inspector. Clearly, there's something I donít understand.

Any help would be greatly appreciated.

Many thanks,

08-24-2009, 12:07 AM
Maybe these instructions (http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WScbb6b82af5544594822510a94ae8d65-7aa3a.html) will help.

I think onLoad is the attribute you want to add, type=text, name it anything you like and you probably want to leave it empty for the default.

08-24-2009, 05:55 PM
Thanks! That gave me enough to figure it out. I made the onLoad attribute of body tag editable in the template, as you suggested, and then the template updated all the pages, as it should. I then selected the Home page and was able to apply the appear/fade behavior to the body tag. Unfortunately, the ONLY thing it would apply to is onClick, not onLoad. OnClick worked great, but onLoad refused to behave (pun intended). So, I copied the onClick code to the clipboard and pasted it into the onLoad event in Modify -> Template Properties. That made it work fine. It certainly wasn't intuitive, but it finally worked. Many thanks.

However, even though it works, I don't like it. When the page loads, the image is visible briefly, disappears, and then reappears like it should. It kinda ruins the effect. Any ideas? I'm thinking maybe I should put the image in an AP div and have it invisible. Then it would start out invisible and the behavior would make it appear. Think that would work?


08-25-2009, 02:36 AM
Oops, my bad. Making the image "hidden" works just fine even if the div isn't an AP div.

11-11-2009, 08:13 AM
Hi all,
I have exactly the same problem when I try to get a whole page to fade in.
The whole page apears momentarily then dissapears and fades in properly.
Also once loaded images and text look distorted for some reason??
I have my page set up as a main div containing header, contents and footer divs.
I want to apply the fade in to the main div so the whole page fades in but it doesn't matter what element I apply the fade in to, the results are the same.
Can anyone tell me how to stop the contents apearing before the fade is executed and any ideas why it is distorting the contents?? (it's definitly the effect that causes the distortion because removing it makes everything fine again).


11-11-2009, 05:36 PM
Clive, do you have a link so we can look at what is wrong?

11-12-2009, 07:22 AM
Sorry its on a local testing server at the moment. I'll look into getting it online somewhere so that you can see what I mean. Thanks for the reply.