PDA

View Full Version : tabdropdown error with ajax include (IE7)



huckabuck
07-02-2008, 06:39 PM
1) Script Title: AJAX Includes script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxincludes.htm

3) Describe problem: I am loading an html menu page with the include script. The html page contains the code for the Drop Down Tabs (5 styles) menu example 3. Everything works great with FF, but with IE7 only the top level menu is shown. I get the following error message when any page loads:

tabdropdown is undefined

and the 2nd level of menus does not appear. I know the script calling the tabdropdown.init in the included html file is not running.

By copying (shown below) the script and placing it after the ajax include I can get IE to see the 2nd level menus, but I still get the error. This action does not seem to affect FF.

<div id="topsection"><div class="innertube"><script type="text/javascript">ajaxinclude("header.htm")</script><script type="text/javascript">
//SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
tabdropdown.init("slidemenu","auto")
</script>
</div></div>

Is there a way around this problem? While my test fix worked I still get an error on every page and this is not an elegant work around.

Any light you can shed on this problem will be greatly appreciated. I have been trying to resolve this problem for quite a while.

huckabuck
07-03-2008, 02:48 AM
I resolved this issue by replacing the ajax include calling the menu with an SSI include. I had to make some adjustments to the .css file to make everything line up correctly, but the menu now works in both FF & IE. Whew!

ddadmin
07-03-2008, 08:24 AM
An SSI include (http://www.javascriptkit.com/howto/ssi2.shtml) is usually the first thing you should always try (instead of using the simulated Ajax Includes script) if your server supports it, as it's the most reliable and efficient way of embedding the contents of one file onto the current page.

huckabuck
07-03-2008, 03:31 PM
I did originally have a three pane menu setup with SSI calls. I changed it to ajax because I made some changes to the overall structure which caused my menus to no longer line up properly. I did not want to reset everything so I needed a different strategy. The ajax includes coupled with the .css gives me total control over the layout. It took a few minutes but I was able to line up the page properly with the ssi call and 2 ajax includes. Fortunately, these changes were minor but had to be made in every html file.

I am just learning how to deal with ajax and other more advanced web development techniques. Problems are a great way to learn, but it's always painful.

Thanks and BTW, your scripts are phenomenal!