PDA

View Full Version : JS Tabs not working well.



bear
May 30th, 2008, 12:27 PM
Whenever I click on the tabs to activate this function, it disappears in IE instead of showing the image. Any ideas of what could be happening?


function tabsBrowse(strTab)
{// tabbed browsing for the top 3 drinks(search.php)

// get all the
/*
var divNew = document.getElementById("divRecent1");
var divRec = document.getElementById("divRecent2");
*/
// var divRec = document.getELementById("");
switch(strTab)
{
case "new":
//alert('new');

document.getElementById("divRecent1").style.display = "block";
document.getElementById("divRecent2").style.display = "none";
// IMAGE SWITCH
document.getElementById("imgsNewDrk").src = root +"/images/root/tab_off.gif";
document.getElementById("imgsNewDrk1").src = root + "/images/root/tab_on.gif";

break;

case "season":
document.getElementById("divRecent1").style.display = "none";
document.getElementById("divRecent2").style.display = "block";
// IMAGE SWITCH
document.getElementById("imgsNewDrk").src = root + "/images/root/tab_on.gif";
document.getElementById("imgsNewDrk1").src = root + "/images/root/tab_off.gif";

break;
}
}

bear
May 30th, 2008, 05:00 PM
bump?

bear
May 31st, 2008, 01:23 PM
http;//drinklab.net

the site I'm trying to get this to work on.

actionAction
May 31st, 2008, 03:58 PM
Works in IE7 but throws "root undefined", which looking at the JS you posted seems to be true. Firebug shows the same error (but Firefox is nice enough to ignore the error). You need to check where/if you are defining root and fix that. On a side note, it's confusing that you can't click the entire tab to switch them, just a tiny portion of the body does the actual change. The div is over the image (z-index), so you should probably put your onclick on the div. Here is the first div you should add it to:


<div id="apDiv2" style="position: absolute; left: 45px; top: 633px; width: 186px; height: 24px; z-index: 99; text-align: center; font-weight: bold; color: white; padding-top: 4px;">

bear
June 2nd, 2008, 10:42 AM
Works in IE7 but throws "root undefined", which looking at the JS you posted seems to be true. Firebug shows the same error (but Firefox is nice enough to ignore the error). You need to check where/if you are defining root and fix that. On a side note, it's confusing that you can't click the entire tab to switch them, just a tiny portion of the body does the actual change. The div is over the image (z-index), so you should probably put your onclick on the div. Here is the first div you should add it to:


<div id="apDiv2" style="position: absolute; left: 45px; top: 633px; width: 186px; height: 24px; z-index: 99; text-align: center; font-weight: bold; color: white; padding-top: 4px;">


Fixed that, but it keeps disappearing in IE 6. IE 6 is the standard that I'm using for this project.

UPDATE:
It's cool! Got her to work. I misspelled a variable name.