PDA

View Full Version : IE Not Reading .js File



UltraMegaOK1988
08-13-2006, 11:19 PM
On my website -- http://baerwcb.tripod.com/ -- you will see that I call my navigation with a JavaScript file. It works fine in Firefox (not a surprise), but IE just doesn't want to read it for some reason. I've been troubleshooting this problem for about a month and a half and have come up empty. Perhaps a fresh mind could help me out.

Also, is there any fix to push my body content up in line with the navigation bar in IE? It's fine in Firefox, but it's down a bit in IE.

Here are some screenshots so you see what my problem is:

Firefox:

http://img59.imageshack.us/img59/5125/ffhv1.jpg

Internet Explorer:

http://img59.imageshack.us/img59/1927/ieuz3.jpg

The JS file can be found here: http://baerwcb.tripod.com/nav.js

Thanks for your time.

Twey
08-13-2006, 11:35 PM
It doesn't work in Opera either. The problem is these spaces around the equals (=) symbol:
<script type="text/javascript" src_=_"http://baerwcb.tripod.com/nav.js"></script>This illustrates another problem, though: browsers without Javascript enabled cannot navigate around your site. You need to rethink your script design.

mburt
08-13-2006, 11:38 PM
And handheld devices

UltraMegaOK1988
08-13-2006, 11:53 PM
Well, it's just a "blog," though I don't like to refer to it as one. If I was running a business, I'd definitely make it extremely user-friendly.

I removed the spaces and it still doesn't want to read it. Any other ideas?

Twey
08-14-2006, 12:01 AM
Wow, for once IE's doing something right and Firefox is being too lenient.
It's this trailing comma:
var linkData = {"Home":"index",
"Sports":"sports",
"Politics":"politics",
"Graphics":"graphics",
};Well, if you don't have anything worth reading, I guess you don't have to worry about people not being able to read it. Why even bother fixing the script error? You're restricting your viewers anyway.

mburt
08-14-2006, 12:10 AM
Ya' know.. I figured it would be easier to make a menu in HTML. In JavaScript, it sounds twice as hard (not necessaril hard, as much unnecessary work :))

UltraMegaOK1988
08-14-2006, 12:55 AM
I made it in JavaScript so it would be easy to change my menu should I ever want to add, remove, or edit anything. If I do it via HTML, I have to go through each of my pages (between 75-100) and change it.

Thanks for the help.

Any idea on how I can get IE to put the body of my page in the same way Firefox does?

IE still acts up a bit when you click on the links in the menu... it makes it green for some reason.

Twey
08-14-2006, 01:09 AM
I made it in JavaScript so it would be easy to change my menu should I ever want to add, remove, or edit anything.I see you're using a host that doesn't support server-side scripting. This would definitely be the best way of doing this. Since you lack it, you have two options:
Use an iframe for the menu. Create an index page with a list of all the links in the navigation menu, which you update when you update the menu. Have a plain HTML link on each in the navigation area, which you hide with Javascript.
Any idea on how I can get IE to put the body of my page in the same way Firefox does?Find out what's causing the gap and remove it. It's probably a margin on one of the elements around that area.

UltraMegaOK1988
08-14-2006, 01:20 AM
I see you're using a host that doesn't support server-side scripting. This would definitely be the best way of doing this. Since you lack it, you have two options:
Use an iframe for the menu. Create an index page with a list of all the links in the navigation menu, which you update when you update the menu. Have a plain HTML link on each in the navigation area, which you hide with Javascript.Find out what's causing the gap and remove it. It's probably a margin on one of the elements around that area.

Doesn't an iframe have scrollbars and borders, though? It would look weird in a navigation bar.

I don't understand what you mean with #2.

As for the IE gap, if I change something in my CSS (where the margins are set), it will change it in Firefox. If it's right in one, it's wrong in the other. Is there a way I can set it one way in IE and another way in Firefox, perhaps?

Again, thanks for the help, it's much appreciated.

Twey
08-14-2006, 01:38 AM
Doesn't an iframe have scrollbars and borders, though? It would look weird in a navigation bar.It doesn't have to. You can style it, like any other element.
I don't understand what you mean with #2.Have a separate HTML page, with all the links that are in the menu. Then, on your pages in the navigation area, have a plain HTML link to that page, saying, for example, "site map." Hide this link (by setting display:none) using Javascript, so that only people with non-Javascript browsers will see it.
As for the IE gap, if I change something in my CSS (where the margins are set), it will change it in Firefox. If it's right in one, it's wrong in the other. Is there a way I can set it one way in IE and another way in Firefox, perhaps?There are a few. The best is to use conditional comments. See MSDN (http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp) and QuirksMode (http://www.quirksmode.org/css/condcom.html) for details.

UltraMegaOK1988
08-14-2006, 02:02 AM
Thanks for clearing it up.

Another question, can I put those IE-conditional statements in a .css file, or does it have to be in my HTML file?

Twey
08-14-2006, 02:22 AM
No, it has to be in your HTML file. But you can use it to hide a stylesheet link from other browsers, in which you can override settings in the normal sheet that you don't want to apply to IE.

UltraMegaOK1988
08-14-2006, 02:53 AM
Hmm... this is tricky.

Since I can do the [if IE] trick, can I also do [if Firefox]? I Googled it but nothing came up.

When one works, the other doesn't, even when I use IE conditionals.

Twey
08-14-2006, 03:07 AM
No, only IE understands conditional comments. Like I said, there's no need to hide the normal stylesheet from IE, since you can just override the bits you don't want in the IE-only one.

UltraMegaOK1988
08-15-2006, 03:25 AM
Thanks for the help.

I still can't figure out how to make it the same in IE and in FF... it's not a big deal anyway, so I'll leave it as it is.