...

View Full Version : Mini-Tabbed Window section in FF not working



hlj71
08-17-2009, 06:32 PM
Resolved -
Hi! I am new to this forum and am hoping I can find some help here. I am not a JS coder, but am trying to use a little bit of code. I have a section on a web page that I want to have tabbed areas in so when the user clicks on the 1st tab, information related to that tab is displayed. When they click on the 2nd tab, informaiton related to the 2nd tab is displayed and so on. This actually is working if you view the page via IE, but I need it to also work via FF.

I have the JS and CSS files online. Here is the webpage: http://www.aahahealthypet.com/tab_testing.html

Here is the JS:

//a public function that the container uses to pass in values for the labels
function public_Labels(label1, label2, label3, label4){

document.getElementById("t1").innerText = label1;
document.getElementById("t2").innerText = label2;
document.getElementById("t3").innerText = label3;
document.getElementById("t4").innerText = label4;
}

//a public function that the container uses to pass in values for the card containers
function public_Contents(contents1, contents2, contents3, contents4){

document.getElementById("t1Contents").innerHTML = contents1;
document.getElementById("t2Contents").innerHTML = contents2;
document.getElementById("t3Contents").innerHTML = contents3;
document.getElementById("t3Contents").innerHTML = contents3;

init();
}

//sets the default display to tab 1
function init(){
document.getElementById("tabContents").innerHTML =document.getElementById("t1Contents").innerHTML;
}

//this is the tab switching function
var currentTab;
var tabBase;
var firstFlag = true;


function changeTabs(evt){
if(window.event) evt=window.event;

if(firstFlag == true)
{
currentTab = document.getElementById("t1");
tabBase = document.getElementById("t1base");
firstFlag = false;
}

if(evt.srcElement.className == "tab"){

currentTab.className = "tab";

tabBase.style.backgroundColor = "";

currentTab = window.event.srcElement;

tabBaseID = currentTab.id + "base";

tabContentID = currentTab.id + "Contents";

tabBase = document.all(tabBaseID);

tabContent = document.all(tabContentID);

currentTab.className = "selTab";

tabBase.style.backgroundColor = "";

document.getElementById("tabContents").innerHTML = tabContent.innerHTML;
}
}

Thank you, Thank you, Thank you for any help anyone can give me.

hlj71
08-17-2009, 06:47 PM
Sorry to have bugged you guys. I just got some help from another forum that fixed my FF problem. Here is the link to the post in case someone else is looking for similar help.

http://www.webdeveloper.com/forum/showthread.php?t=214869

ohgod
08-17-2009, 06:50 PM
was on testing when it was failing due to evt being undefined. by the time i was typing a response you changed your script and it's now working in FF. guess you got it sorted :P



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum