Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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