Solved

Modifying Template so that body (onload) function can be changed as required

Posted on 2006-07-05
3
242 Views
Last Modified: 2010-04-25
Hi all,
I have child pages where many of them require a different body onload tag (i.e. <body onLoad="document.theformonthepage.submit();"> ). I want to make this region editable on the child pages so I can alter this as required. When I try to select the text in the code and click add editable region it doesn't work. I've also tried going to Template > Modify > Make Attribute Editable but it goes I can't seem to edit it correctly on the child page. It gives me this on the child page:
<!-- InstanceParam name="onload" type="text" value="start()" -->
</head>

I think the above is concerned with the <head> as its enclosed in the tag and when I change the onload to the document.theformonthepage.submit();" it doesn't work. e.g (<!-- InstanceParam name="onload" type="text" value="document.form1.submit();" -->)
Anyone have any ideas?
Thanks,
D
0
Comment
Question by:dereksheahan
  • 2
3 Comments
 

Author Comment

by:dereksheahan
ID: 17041235
I've also tried creating a second template with the body onload tag included but run into the same problem as I can't edit the name of the form in it (i.e. onLoad="document.theformonthepage.submit();"> )
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 450 total points
ID: 17044653
Hi Derek,

1. Open the template.  In code view, change the body tag so it looks like this:  <body onload="">

2. In design view, click the body tag from the tag selector at the bottom of the screen

3. From the menu, select Modify | Template | Make Attribute Editable

4. In the dialog, the attribute ONLOAD should show up in the box automatically.  Click the "Make attribute editable" checkbox

5. For the rest of the options:

Label = this is what DW will display to you so you know what you are editing.  I'm leaving it as onload for demo
Type = leave as text
Default = you can leave this blank or put your most common JS statement (i.e. document.theformonthepage.submit(); )

Click ok to set it.  In code view of the template, you should see something like this:

<!-- TemplateParam name="onload" type="text" value="document.theformonthepage.submit();" -->

And the body tag will look like this:

<body onLoad="@@(onload)@@">.

Now, apply the template to a new blank page.  After application,  go to Modify | Template Properties and you will see a dialog with "onload" in it.  Select onload and enter whatever you need.
0
 

Author Comment

by:dereksheahan
ID: 17053478
Great Jason, that fixed it alright!
Thanks,
D
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now