PDA

View Full Version : Problem with all-level-menus in IE



Paul Rivers
03-04-2009, 11:35 AM
1) Script Title: All-Level Navigation Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/index.htm

3) Describe problem:

Hi,
Having problem with this script. I've added the menu's to an existing site in development, and it works without problem in FF, and Chrome. IE, however is driving me nuts!

The script I'm using to create the menu-stucture is an ASP script, pulling entries from a database, and creating the HTML list structure needed to create the menus.

Looking at the output using Firebug, all looks ok, and the menu's work fine.

In IE, it seems the script stops processing right after the first right-arrow gets rendered, and generates a javascript error:

'offsetWidth' is null or not an object - in line96 of ddlevelsmenu.js

I'm generating the "ddmenusideX" programatically. Viewing the source of the page in IE, shows that only the 1st ddmenuside code section is there, and the other (5) are missing - I guess the browser just gave up after the javascript error & stopped parsing the output.

Also - noticed that the IE output has a gap at the right of the top-level menus (around 15px or so), between the menu entries and the black-line around the menus. Don't know if that helps shed any light.

Originally, I had the menus in a table column, but I've stripped all that out so it's just there directly on the page.

Additionally, turning OFF the right-arrow, helps somewhat, as it the generates the sub-menus, but not all of them. Hmmm, strange!

So, I'm guessing that the problem is somewhere in the offset positioning of the right-arrow, maybe caused by the gap at the right of the menus forcing it ofver to the left a bit - but I AM guessing.

Unfortunately, although I'm an advanced ASP programmer, my javascript skills are a bit limited.

Any advice, apart from turning to alcoholism? This one's driving me crazy!

If anyone's trying to help me out and wants to see the page, I'll point you to the URL.

Paul Rivers
UK

ddadmin
03-05-2009, 08:37 AM
I'm generating the "ddmenusideX" programatically. Viewing the source of the page in IE, shows that only the 1st ddmenuside code section is there, and the other (5) are missing - I guess the browser just gave up after the javascript error & stopped parsing the output.

This is the part that's most crucial. Are you saying when you view source on the generated page, it's missing 5 of the code chunks literally? If so, this can only be a result of your ASP code not outputting everything, and has nothing to do with the script itself.

In general, the checklist for using any server side language to dynamically output client side JavaScripts is the same. As long as what gets output to the browser looks identical to as if you've manually included the script on your page, it should work. While trying to get the output to work, use the browser's view source feature often to check that the code that's being output comes closer and closer to how it should look.

Paul Rivers
03-09-2009, 12:32 PM
Hi,

Thanks for your reply.

Yes, I'm looking at the code output in the 'view page source' on the browser.

Problem is, it WORKS fine using firefox, Google-Chrome and Opera, so I'm (99.9%) sure that the ASp code is outputting correctly. It's ONLY in IE that I can't get it to look right.

So, there seems to be some kinda compatibility thing going on here.

If I look at the page-source in firefox, the ASP code has output the list-structure for the menu's just right. I don't think the problem is there, though, as the javascript error seemd to be related to the positioning of the right-arrow in the menus.
If I turn off the right-arrows in the .js file, it does make quite a difference - I do get all the 1st-level menus ok, but sub menus are all open before mouse-over, and don't all appear.

Wierd.

ddadmin
03-09-2009, 08:13 PM
So all the code for the menu is there when you view source (make sure that's the case), as if you've manually included it on your page? Please post a link to the page on your site that contains the problematic script so we can check it out.