Solved

display error caused by javascript in a server side include

Posted on 2004-08-04
15
237 Views
Last Modified: 2013-11-18
I'm a newbie.
On the following page, http://www.cristorey.net/practice/practice.shtm, there is a space above my nave bar that messes up the site's display.  If you visit the page, it's quite clear what I'm talking about.  The nav bar is a server side include that utilizes javascript.  For some reason, when the nav bar existed not as an include, but as part of the page, it displayed correctly.  When I insert the nav bar from the library as a scrip object, it no longer displays correctly.  Clicking on any of the links in the dropdown menu should show you the correct display.

Many thanks.
g.r.
0
Comment
Question by:grkearney
  • 5
  • 4
  • 3
  • +1
15 Comments
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
I'm surprised it displays at all.
You have multiple body tags. You have the javascript called AND in the page - I'm assuming it's the same thing. It's also there numerous times, both on the page and as a script tag. I counted THREE calls to the SAME script without looking far, and another one that looks like it's the same thing in another folder (or maybe the same folder, I don't know your directory structure).

Clean up the code.  
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
>>404 Object Not Found
Can try re-upload the file again?

regards
0
 

Author Comment

by:grkearney
Comment Utility
Ryancys:
It's back up.  Sorry I was working on it.  Webwoman, not sure I understand everything you're saying.  I bounced around in the code for a long time tonight.  Tried to clean things up.  Here's exactly what I am doing.  I built the pop-up menu in Fireworks.  I am inserting the fireworks object on an html page that is my server side include.  Then I am trying to call the include file in a template.  The page you guys are looking at, practice.shtm is derived from a template.  99% of what I do us WYSIWYG.  I have a hard time manipulating the code or knowing exactly what to do with it.  I've used includes before to accomplish the same end, but haven't experienced these spacing problems.  If you can give me some sense of how to clean up the code, I'd appreciate it.  More importantly, though, if you can help me get the page to display properly, I'd appreciate it.  THe pop-up menus, despite problems that may exist in the code, work fine.  You can actually use them to get to pages that aren't currently utilizing the ssis.  

I'm grateful for your help, and especially grateful if you can dumb down your comments for this newbie.  Many thanks.
gr
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
What if you cut and move the Javascripts below to the place just after "<Body>" tag? I think that may cause the line problem?

<script language="JavaScript">
<!--
function mmLoadMenus() {
  if (window.mm_menu_0801142101_0) return;
...
..

//-->
</script>
<script language="JavaScript1.2" src="../Library/mm_menu.js"></script>
<script language="JavaScript1.2">mmLoadMenus();</script>

Also, try to set the td height to 1 or remove it, try don't set it as 69 .. like:

<td height="69" align="left" valign="top"><img src="/assets/hdr_about_cristo_rey.gif" width="750" height="69"></td>

to:

<td height="1" align="left" valign="top"><img src="/assets/hdr_about_cristo_rey.gif" width="750" height="69"></td>

regards
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
oh, of course, edit it from your template file (it's a good habit always backup you files before you start amend it ;-)
0
 

Author Comment

by:grkearney
Comment Utility
Ryan:
Here's the deal.  When I edit in the template, the template doesn't show all the javascript code.  It just shows one line saying that it will include the server side include.  I can move the code on the include file, but there there's really nowwhere to put i, because to create the insertable file you've got to remove the document head and all that information.  With all that said, if you go to the page now, the javascript code for the menus is beneath the body tag.  I also set the cell heights for the banner and for the nav bar to 1.  But none of it works.  I still have the white line.  I also went in to dreamweaver and edited my preferences so that it doesn't show the icon for the script.  That didn't change anything.  I have no idea what to do next. Do you have any ideas?  Thanks for your help.

Take care,
george
0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
You need to DIRECTLY EDIT THE CODE. And a template is NOT the way to do it.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:grkearney
Comment Utility
webwoman:
THe site has hundreds of pages.  It seems tedious to have to edit the code on all of them.  I can edit the code on in the template.  If I get it right there, it will be right everywhere else, right?  Except the fact for the fact that i generated the javascript code from Fireworks.  So, how do I do it?  Your above suggestion doesn't tell me too much.
0
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
Just an idea, try set the table/tr/td background images to same as your header picture? So that it will cover the white line.. just guess it will works..
0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
First, get rid of any extraneous stuff in the javascript.
Second, make sure the template code is clean -- squeaky, 99/100% clean. Do it IN CODE. DO NOT use DW, it won't let you edit where you need to edit. You need to edit all the junk that's been put in by FW.

And you WILL have to edit EVERY SINGLE PAGE. That's the ONLY way you're going to make this work right.

Does your server support any server side scripting? That's really the way to do this. If you want to cut down on maintenance in the future, you're going to have to invest a large chunk of time now. I suspect that with some serious rethinking of how the site is constructed, you could get that 'hundreds of pages' down A LOT.
0
 
LVL 8

Accepted Solution

by:
alexhogan earned 100 total points
Comment Utility
You said that after you made the nav bar a library item that you got the white line?

Webwoman hit it on the head when she said you have multiple tags in your page that are causing you problems.  However I don't think that editing every file is necessary.

When you look in your library item insure that you don't have any html tags other than the ones used to create the table that contains the nav graphics.  If you have any body or head tags remove them.  Be careful though because you will then need to take the javascript that may be in that file and place it in the main template file under the rest of the Macromedia generated code.  Make sure that you are not duplicating any of the javascript.

Even better would be to create a seperate .js file and place the code in that.  You can do this from the new file menu.  Then you will need to link the template to this file.

If you clean those out and insure that you are not duplicating any tags or javascript code between the library item and the template you should be OK.

Then you can still use your templates and everything will update like you expect.
0
 

Author Comment

by:grkearney
Comment Utility
Alex:

THanks.  I think I figured it out... thanks in part to your suggestions and those of webwoman.  You were right.  I didn't have to edit every singe page, but did have to clean up the code.  I then encountered another problem where the include file wasn't displaying on pages in subdirectories.  Buit moving the include file into the same directory with the images that made up the include solved that.  

I have one last little question, though.  THe point of setting up the includes has been to get the folks who will manage content for the website at the school to be able to update more easily without relying on making changes in templates that are applied to many many pages.  Now they'll just be able to make changes to the include files and the changes will then be reflected sitewide.  They'll use fireworks to edit the pop-up menus.  At least this is my plan... so, with that as a goal, does it still make sense to create the external .js file.  That, in all likelihood, would be more difficult for them to edit.  I don't know too much, and they know a lot less than me.

Thanks,
george
0
 
LVL 8

Expert Comment

by:alexhogan
Comment Utility
I think it is always best to take a compartmentalized or modular approach.  Whether it's a dynamic or a static site.  That way if you have a global change you reference it in a single place.

If you are going to have many people responsible for the updating of a site then I would suggest converting to a dynamic architecture.  That will allow the greatest amount of people with a generalized skill set to make content changes, additions or modifications.

If they are just going to be updating pop-up menus along with the content then I would still suggest an external file.  What you will be changing isn't directly graphic related is it?  If it's just navigation and menu items then you can change them in FW and note the changes in the script produced and place it in the external file.

It's a little extra work, but it will insure integrity.
0
 

Author Comment

by:grkearney
Comment Utility
okay, so, to create the external file, just file new, in dreamweaver, and choose a javascript file.  Then copy the code that fireworks generates.  Then, in the template file, link to the external file.  What about the graphics.  Are they folded into the javascript.  Or do I still insert them?  Right now, I just insert the library item.  That included the javascript code and the graphics.  

thanks.  last question and I'll leave you alone.
0
 
LVL 8

Expert Comment

by:alexhogan
Comment Utility
[snip]
okay, so, to create the external file, just file new, in dreamweaver, and choose a javascript file.  Then copy the code that fireworks generates.  Then, in the template file, link to the external file.
[/snip]

Yes

[snip]
What about the graphics.  Are they folded into the javascript.  Or do I still insert them?
[/snip]

The graphics are part of the page.  The javascript will preload and swap the graphics and give you the navigational functionality.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

744 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

16 Experts available now in Live!

Get 1:1 Help Now