View Single Post
Old 01-05-2008, 12:36 PM   #1 (permalink)
gnznroses
Contributing Member
 
Join Date: 12-14-05
Posts: 109
iTrader: 0 / 0%
Latest Blog:
None

gnznroses is on the right pathgnznroses is on the right path
Thumbs down Javascript: works in IE, not FF

i had someone modify a script for me. the script creates tabs for "pages" of content and puts the tabstrip only on the top of the content. so i had them add a tabstrip along the bottom of the content as well.
problem is, when you click the tabs on that bottom row, it works in IE but not in FF.
i can't figure out how this works so i'm really hoping someone else can...

here's a code excerpt and the changes he made (in red):
Quote:
var oThis = this;
/* Create a link to activate the tab */
DOM_a = document.createElement("a");
DOM_a.appendChild(document.createTextNode(t.headin gText));
DOM_a.href = "javascript:void(null);";
DOM_a.title = t.headingText;
//DOM_a.onclick = this.navClick;
addEvent(DOM_a,"click",oThis.navClick);



/* Add some properties to the link so we can identify which tab
was clicked. Later the navClick method will need this.
*/
DOM_a.tabber = this;
DOM_a.tabberIndex = i;

/* Do we need to add an id to DOM_a? */
if (this.addLinkId && this.linkIdFormat) {

/* Determine the id name */
aId = this.linkIdFormat;
aId = aId.replace(/<tabberid>/gi, this.id);
aId = aId.replace(/<tabnumberzero>/gi, i);
aId = aId.replace(/<tabnumberone>/gi, i+1);
aId = aId.replace(/<tabtitle>/gi, t.headingText.replace(/[^a-zA-Z0-9\-]/gi, ''));

DOM_a.id = aId;
}

/* Add the link to the list element */
DOM_li.appendChild(DOM_a);

/* Add the list element to the list */
DOM_ul.appendChild(DOM_li);
}

/* Add the UL list to the beginning of the tabber div */
e.insertBefore(DOM_ul, e.firstChild);

/* Copy the UL list to the end of the tabber dib */
var bottom_DOM_ul = DOM_ul.cloneNode(true);
e.appendChild(bottom_DOM_ul);

if i restore the click event line back to how it was, then the bottom tabs don't work in IE either.

here's a live copy to see what i'm talking about:
http://bashsoftware.net/temp/tabs/tabsexample.html

(the actively selected tab doesn't change colors as it should either, but i have a fix for that, not included in this version of the script)

-edit-
need to see the navClick function?
gnznroses is offline   Reply With Quote