PDA

View Full Version : abref has no properties



zorag
04-11-2009, 01:38 PM
1) Script Title: Ajax Tabs Content v2.2

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

3) Describe problem:

I'm getting this error when using the FireBug console on Mac and PC:


tabref has no properties
[Break on this error] var relattrvalue=tabref.getAttribute("rel")

It's in ajaxtabs.js line 137

I haven't modified anything in the js file it's as standard.
Any suggestions..

jscheuer1
04-12-2009, 01:44 PM
Which script are you using? You say you are using Ajax Tabs Content v2.2, but you link to Tab Content Script (v 2.2).

In either case, if the rel attribute has no corresponding element at the time it is processed by the script, there will be an error.

If you want more help:

Please post a link to the page on your site that contains the problematic code so we can check it out.

zorag
04-12-2009, 05:13 PM
Thanks for the prompt reply John - appreciated!

The error is showing in most pages that contains the Ajax Tabs Content script, ie:
http://www.myhooligans.com/index.php?t=home_index

jscheuer1
04-12-2009, 06:01 PM
Well, you have:


<script type="text/javascript">
var playt=new ddajaxtabs("playtab", "playdiv")
playt.setpersist(false)
playt.setselectedClassTarget("link") //"link" or "linkparent"
playt.init()
</script>

and:


<script type="text/javascript">
var centert=new ddajaxtabs("centertab", "centerdiv")
centert.setpersist(false)
centert.setselectedClassTarget("link") //"link" or "linkparent"
centert.init()

But there are no links with rel=playdiv or rel=centerdiv. But the script is looking for those to see which one should be selected.

Now, I can't really tell if you even need to have those two script blocks or not. From what I can see, they're not being used, so you should just get rid of them. If that causes a problem, there is probably some way to get around it - to achieve what they achieve without the error. But, if you can just get rid of them, that would probably be the best solution, as I think they may be left over from an earlier version of the page that had links with those rels, or that they were setup in anticipation of such links that were never added.

zorag
04-17-2009, 01:14 PM
Yes the "playdiv" and "centerdiv" are being used for instance if you look at the "centerdiv" container you can see the sort orders there "Newest, Most Played etc.." which pull in pages into the div AFTER it initially loads the gallery, demo here: http://mediapro.oinkba.com/index.php?t=_djs

I'm just wondering if there was a way for the script to not detect the lack of a tab link and give out an error, here's what the code I'm using looks like using Smarty PHP to initially pull in the gallery into the "centerdiv".


<!-- Center Ajax Box -->
<ul id="centertab" class="no-shadetabs">
</ul>
<div id="centerdiv" style="margin-bottom: 20px;">
<!-- Ajax Gallery -->
{jr_ranking mode="artist" order="3" pagebreak="21" quota_id=$smarty.config.producers_id header_template="_producers_gallery_header.tpl" row_template="_producers_gallery_row.tpl" footer_template="_producers_gallery_footer.tpl" require_image=$smarty.config.require_images replace_0=1}
</div>
<script type="text/javascript">
var centert=new ddajaxtabs("centertab", "centerdiv")
centert.setpersist(false)
centert.setselectedClassTarget("link") //"link" or "linkparent"
centert.init()
</script>

Any suggestions..

Thanks
Huw

jscheuer1
04-19-2009, 09:50 AM
OK, here's what I'd try - In ajaxtabs.js add the highlighted line to the expandtab function:


expandtab:function(tabref){
if(!tabref) return;
var relattrvalue=tabref.getAttribute("rel")
//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easy searching through
var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
if (relattrvalue=="#default")
document.getElementById(this.contentdivid).innerHTML=this.defaultHTML
else if (relattrvalue=="#iframe")
this.iframedisplay(tabref.getAttribute("href"), this.contentdivid)
else
ddajaxtabs.connect(tabref.getAttribute("href"), this)
this.expandrevcontent(associatedrevids)
for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("href")==tabref.getAttribute("href"))? "selected" : ""
}
if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
ddajaxtabs.setCookie(this.tabinterfaceid, tabref.tabposition)
this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
},