Solved

display error caused by javascript in a server side include

Posted on 2004-08-04
15
240 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
ID: 11715569
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 51

Expert Comment

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

regards
0
 

Author Comment

by:grkearney
ID: 11722931
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 
LVL 51

Expert Comment

by:Ryan Chong
ID: 11723036
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 51

Expert Comment

by:Ryan Chong
ID: 11723042
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
ID: 11725107
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
ID: 11728057
You need to DIRECTLY EDIT THE CODE. And a template is NOT the way to do it.
0
 

Author Comment

by:grkearney
ID: 11728541
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 51

Expert Comment

by:Ryan Chong
ID: 11732365
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
ID: 11732569
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
ID: 11749434
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
ID: 11772909
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
ID: 11773457
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
ID: 11774615
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
ID: 11775486
[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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

821 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