Solved

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

Posted on 2006-07-05
3
244 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
slide show not working correctly 10 407
Download all files with one click 7 593
Lock Form Controls 3 306
Font: I need Lato on my Mac 10 183
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

14 Experts available now in Live!

Get 1:1 Help Now