Solved

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

Posted on 2006-07-05
3
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

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…
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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

735 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