PDA

View Full Version : Tab Content Script Errors



himalayansnowboarder
05-08-2005, 10:06 PM
The Tab Content Script (http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm) gives error in IE6 when a tab is selected before the page finishes loading.

Is there a way to prevent this?

jscheuer1
05-08-2005, 10:34 PM
Four possibles right off the top of my head:

1) Don't click on the tabs until the page is loaded.
2) Get a faster connection to the internet.
3) Don't load so much content onto your page that it takes so long to load in the first place.
4) Hide the tabs until after the page and its script are loaded.

This last one may require explanation, let me know. Gotta run.

himalayansnowboarder
05-09-2005, 12:38 AM
Thank you, jscheuer1 for your quick reply :)

I will try to improve the speed of the page load.

But I definitely would like your explanation for #4!


---

>> 4) Hide the tabs until after the page and its script are loaded.

>> This last one may require explanation, let me know.

ddadmin
05-09-2005, 01:33 AM
Hmmm I'll take a closer look at the script tomorrow, and if there in fact is a bug, post a fix. Note that the tabs definitely cant respond until the page finishes loading due to the way it's designed, but there shouldn't be an error when a user tries to click on the tabs before this is so.

jscheuer1
05-09-2005, 08:14 AM
I was just setting up the demo for this script to make an example of hiding the tabs until the page and script were loaded. My idea was simple enough, set visibility to hidden until the script loads. I figured I'd use the script without the optional persistence feature, just to simplify things. However, without the persistence module I was getting an error:


persisttype is undefined

It was referring to this line in the code:


var cookiename=(persisttype=="sitewide")? "tabcontent" : window.location.pathname

in the function do_onload()

From working with other DD scripts that have this persistence feature, I knew right away that either this function or a part of its code did not belong in the non-persistence enabled version I thought I was creating. Are you using the persistence module? If not, adding it will probably take care of the error. I added it and the error disappeared. There will need to be a rewrite of the non-persistence version and the persistence 'module' as the code is not properly portioned out between the two, together they seem to work fine.

Now, if you were using the persistence feature and still getting an error. And if this error only happens while the page is loading and NOT after the page is loaded, this should take care of it. Add this before the style section:


<script type="text/javascript">
if (document.getElementById)
document.write('<style type="text/css">#tablist{visibility:hidden}</style>')
</script>and add these two lines:


if (document.getElementById)
document.getElementById('tablist').style.visibility='visible'right after this line:


expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])If the problem is due to load time, this will take care of it.

himalayansnowboarder
05-09-2005, 08:29 PM
Your fix works like a charm.

Thanks John!

---

Now, if you were using the persistence feature and still getting an error. And if this error only happens while the page is loading and NOT after the page is loaded, this should take care of it. Add this before the style section:


<script type="text/javascript">
if (document.getElementById)
document.write('<style type="text/css">#tablist{visibility:hidden}</style>')
</script>and add these two lines:


if (document.getElementById)
document.getElementById('tablist').style.visibility='visible'right after this line:


expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])If the problem is due to load time, this will take care of it.[/QUOTE]

himalayansnowboarder
05-12-2005, 03:49 AM
I replied too quickly. The original pdroblem is solved, but now the persistence feature doesn't work anymore.

Help?

Thanks again!

---
[QUOTE=himalayansnowboarder]Your fix works like a charm.

Thanks John!

jscheuer1
05-12-2005, 06:02 AM
Um er, that is not caused by our modifications. The persistence feature works off of the display style not the visibility style which I used for our modification. More than likely you recently switched persistence from local to sitewide or vice/versa or from on to off or just were adjusting it in general. I tried this and it threw things off for awhile until the cookies got caught up with what was happening. My suggestion is just set it the way you want and forget it, in a few days it should work fine for you. Less frequent visitors to your site will not have the problem, as their cookies have expired if, in fact they had any to begin with.