Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dreamweaver pop up menu javascript needs tweeking

Status
Not open for further replies.
May 9, 2003
19
GB
I have recently designed a fab pop-up menu for a new nav bar. It exports perfectly in DW as an html file however, we have around 300 pages that will use this new nav bar so I tried exporting as a library item. This doesn't work as it doesn't export the javascript with the slices so is useless.
The page in question is - you will see the pop up menu at the top of the page in a table, the corresponding javascript sits mainly in the head section with the event handler in the body section. When the navigation table is saved as a library item, the javascript is missing so nothing happens. The library item appears like this Has anyone any advice? Please, please, please!!
Jean
 
I see you are also getting some good advice here:

thread248-711209 [/code]

A couple of things I would pass on:

your working page contains 2 of the function:
function fwLoadMenus()

You need to eliminate one of those.

It will do no good to just make an external .js file unless
you also incorporate the "onmouse" events found in your working page:
<a href=&quot;#&quot; onMouseOut=&quot;FW_startTimeout();&quot; onMouseOver=&quot;window.FW_showMenu(window.fw_menu_0,364,68);&quot; >

These events in the &quot;body inside the table&quot; are what call
the functions to display your menu.

You should be able to &quot;copy and paste&quot; the working table
and it's img links into your other pages.

And when you make your external .js file don't include the
<script> tags that's handled by the tags surrounding the
&quot;src&quot; declaration.

And this spot in your 'html' needs a little work:
<BODY class=&quot;homeTextBody&quot; topmargin=&quot;0&quot; marginheight=&quot;0&quot;>

<tr>
<td colSpan=3 height=&quot;69&quot; valign=&quot;top&quot;>
I don't see a <table ....> for the <tr> <td

Let us know if you have any problems.

2b||!2b
 
thanks for this, I will work on this tomorrow and let you know how I get on. Thanks for your time and advice - it's much appreciated. Jean
 
I have tried to carry out your advice but am having trouble with some of the code. I have got rid of the two functions and the extra table tags in However, I am unsure of how to include the javascript in - this is the file that will replace the navigation table in 300 pages so it needs to be an .lbi file.
I can see how you can call in a .js file in the a regular html page but not into this library file.
I am almost tearing my hair out as it's so irritating.
Any real &quot;dummy&quot; advice would be SO welcome or am I trying to do something that just can't be done?
Thank you. Jean
 
All you have to do now to make your test page work is
to place the section of code:
Code:
<script language=&quot;JavaScript&quot;>
<!--
function fwLoadMenus() {
...
..
.....
  fw_menu_7.writeMenus();
} // fwLoadMenus()

//-->
</script>

Into an external .js file and include it just like you
include:
Code:
<script language=&quot;JavaScript1.2&quot; src=&quot;fw_menu.js&quot;></script>

You want to be sure and &quot;load&quot; them in their current order.
e.g. fw_menu.js last.

I see you now have the mouse events in your test table.
You are very close.

When you create the external file do not include the
<script> tags.

I do not know about this &quot;library&quot; idea.
I understand what you need to do is update this page and
have it affect 300 other pages--easy enough with the
javascript since we can call it from the external source.

I am not aware of anyway other than some sort of server
activity to parse new html. Maybe once we get the test
page going the guys over in the Dreamweaver forum can help
with that.

I'll work up an example for you at lunch, unless you think
you pretty well have a handle on it.

2b||!2b
 
OK, you have taken your function contained on the working page
&quot;function fwLoadMenus()&quot; and saved it in a file and named it 'fw_load.js' and placed
it in the same directory as your 'fw_menu.js' . And you removed the <script> tags
before you saved it as a text file.

Add this section of code to the top of the test page.

Upload it and let's try it out.
Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML><HEAD><TITLE>History the website of the IHR home page</TITLE>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<link rev=made href=&quot;mailto:Janet.Kennington@sas.ac.uk&quot;>
<meta name=&quot;author&quot; content=&quot;Janet Hastings&quot;>
<meta name=&quot;date&quot; content=&quot;14 July 2003&quot;>
<meta name=&quot;keywords&quot; content=&quot;Institute of Historical Research, histoire, UK, Britain&quot;>
<meta name=&quot;identifier&quot; content=&quot;[URL unfurl="true"]http://www.history.ac.uk/welcome.html&quot;>[/URL]
<link rel=&quot;stylesheet&quot; href=&quot;../ihr2.css&quot;>
<script language=&quot;JavaScript1.2&quot; src=&quot;fw_load.js&quot;></script>
<script language=&quot;JavaScript1.2&quot; src=&quot;fw_menu.js&quot;></script>
</HEAD>
<BODY class=&quot;homeTextBody&quot; topmargin=&quot;0&quot; marginheight=&quot;0&quot;>
<script language=&quot;JavaScript1.2&quot;>fwLoadMenus();</script>

And relax, this forum leaves nobody behind.
If you'll let us know when you've done this and uploaded it we'll take a look at it for you.

2b||!2b
 
Looks great to me.

Tell me more about the library idea.

Since your documents are static html files, how do you
invision making the change for 300 pages, I also ask
because someone may have a good idea for you.


Are you comfortable now with changing your test page.
In theory you should be able to extract the top part of
your working page and you will have just have your menu system.

Also, fix this line I abbreviated it for posting.
<meta name=&quot;keywords&quot; content=&quot;Institute of Historical Research, histoire, UK, Britain&quot;>

2b||!2b
 
Yes, it's really coming together - all thanks to your great advice.
The library item is a handy feature in dreamweaver and is usually used for standard html navigation tables so when you need to make a change you simply change the library item and it automatically updates all the pages that it appears in. The code is embedded in the page so all pages need to be uploaded again.
I may save the navigation table as a library item although it will simply be a graphic and then put the two .js reference files in the head section etc. At least, when it comes to adding another submenu, I should be able to update the fw_load.js file manually and just upload that one file.
I don't know whether there is a more streamline way of doing it but I guess once I have upgraded all the pages it should be easy to make a change after that.
But if you know of something better...
 
I see so the library stuff happens locally and then you have
to upload the changed pages to the server...

Just make sure the library item for the nav table contains
the mouse events or your menu won't work.

I enjoyed the project.

Good Luck,
Don't forget to change the line I mentioned in my last post.

2b||!2b
 
yes, the library item is handy but not as handy as an external file but I'll have a combination.
Thanks again for all your help - couldn't have done without you.
Jean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top