PDA

View Full Version : Other events disabled, tabcontent v2.2?



Schmoopy
12-01-2008, 10:02 AM
1) Script Title: Tab Content V 2.2

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

3) Describe problem: Just started using this to replace my attempt, so I could use the URL parameter function, but I need a few pointers on how to accomplish the following.

Firstly, here's a link to the test page so you can see for yourself:

http://www.bombthehills.com/newstuff/guides.html

I want to add some functions to the onclick part of the tabs, so I can change the header, and also expand the box where they are contained, but it seems that with this script all other commands are ignored or something, as they're not working anymore.

Also, in firefox it keeps saying "subcontent is null", where did I go wrong?

Hope you can help,

Thanks,

Jack.

Schmoopy
12-01-2008, 06:40 PM
Update - managed to get functions to work by assigning them to the onmouseup event instead of the onclick.

I still need some help with this weird error I'm getting though, tried linking through a URL but no luck.

jscheuer1
12-01-2008, 07:47 PM
That's odd. Probably something that you did (perhaps in conjunction with a bug in the code) that makes more this.subcontentids than elements bearing those id designations. However, since the code appears to work even with the error, if you were to add error checking to this (as shown):



expandsubcontent:function(subcontentid){
for (var i=0; i<this.subcontentids.length; i++){
var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
if(subcontent)
subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
}
},


That might be all that's required to fix it up.

Schmoopy
12-01-2008, 08:42 PM
Damn your good at all this :D, thanks very much, since doing that I can now select a tab from the URL.

Only error I'm getting now is Error: Permission denied to call method Location.toString

But I'm pretty sure that's because it's on the local host and not on the internet.

Am I right? Or is this another bug I need to fix?

Edit: Spoke way too soon, I was just looking at the tab selected, but although the tab selected is correct, the actual content for it does not change, is this to do with the above error?

jscheuer1
12-02-2008, 03:33 AM
The:


Error: Permission denied to call method Location.toString

Which I was also seeing, is probably from one of the other scripts on the page. In my experience it's common with Google added scripts, but it could be something else. If it is from the Google added script(s), it probably isn't causing any real problem. Google code is written for the lowest common denominator (quirksmode). They don't care if it throws errors, as long as it works most of the time.

Sad as it may be, the only way to definitively diagnose any problems with the tabcontent v2.2 script is to start with only that script. If that works out, then we add, one by one, the other scripts and check at each stage for conflicts. If stripping things down to just the tabcontent v2.2 script still shows an error or errors, that would actually be good news, as we could just deal with that.

I hope you understand what I'm saying, which is basically that you need to get any given script working on its own before integrating it into an environment with other scripts. Approaching things in this manner will distinguish between a problem or problems with the script itself, and a problem with the script in combination with the other scripts on the page.

Schmoopy
12-02-2008, 08:40 AM
Yup, turns out it was the google ad, when I removed it there was no longer an error, but I wonder what about the "?guidetab=0" it doesn't like, as normally the error doesn't happen.

I fixed the other thing now, but it is annoying having an error on the page, do you know if they have a fix for this?

jscheuer1
12-02-2008, 09:53 AM
I don't think it's a factor, though it may be. The thing is with Google code, it's not always delivering the same content. So sometimes there can be an error, sometimes not. Generally it has nothing to do with other scripts. Any appearance that it does could be coincidence.

Of course, you could always test that in various ways. That's been one of my points in this thread. With so many scripts, to track down any particular error requires patient testing.