Stoping DWT from erasing javascript functions

J

John

From within Frontpage 2003, I wrote 2 javascripts in the header section of
my page and everything works as expected when I test the page.

However, after I apply a Dynamic Web Template (DWT) to that page, I get an
"object required" error when testing. Debugging revealed that when the DWT
was applied, it removed my 2 javascripts.

Is there a way to have FP preserve my custom javascripts after a DWT is
applied?

Thanks,
John
 
R

Ronx

In the DWT add an editable section immediately before the </head> tag.
The Javascripts will go in here.

<head>
Meta tags etc.

<!-- #BeginEditable "scripts" -->

<!-- #EndEditable -->
</head>


In the page, temporarily move the scripts to the <body>. Attach the
DWT, then move the scripts back into the editable section.
 
J

John

Almost but it didn't quite work. :(

In my html page there are some FrontPage javascripts defined such as
FP_swapImg(). When I pull out my custom javascript from the html page and
put it in the DWT Editable section per your description below and then apply
the DWT to the html page, my custom javascripts fall outside </script> tag.

Because it comes after the </script> tag, the code ends up being displayed
on the page.

Did I miss a step?
John
 
R

Ronx

The FrontPage behaviours will (should) take care of themselves.
Switching between design view and code view usually restores those
scripts if they disappear.

Do not put your custom JavaScript into the DWT, unless you want the same
script on all pages. In that case place it in the <head> section of the
DWT, but *outside* any editable areas.

The editable region is a placeholder for scripts on a per page basis.
On each page which has unique scripts, move them to the <body> section
in CODE view, including the <script> and </script> tags. This move is
only to provide a copy (I generally copy to clipboard, attach DWT, then
paste back, but have on occasion lost the scripts by copying something
else before restoring the scripts).
Attach the DWT.
Move the scripts back into the editable region.
Now there should be no trace of the scripts in the <body>.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/
http://www.rxs-enterprises.org/fp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top