Javascript Function to show/hide tabs and iFrames:
function ChangeStep(id)
{
var i = 1;
// hide all other tabs:
while(i<3) {
var divID = 'tabs' + i;
if (divID !== null) {
document.getElementById(divID).className = " hide";
}
i++;
}
// show this one
document.getElementById(id).className = " show";
}
if (id == "tab2") {
document.getElementById(iFrame).className = " iFrame2";
}
else if (id == "tab1") {
document.getElementById(iFrame).className = " iFrame1";
}
The change of tab works, but the if statement at the bottom doesn't seem to work.
EDIT
The issue is that I have an iFrame with the id of 'iFrame'.
Now I made 2 Classes in the css file called: 'iFrame1' and 'iFrame2' which have different settings and which make the iFrame look different.
The function above has no problem in changing the 'tabs' (Add the class 'Show' to one and 'Hide' to all others).
But it doesn't seem to change the iFrames class to 'iFrame2' and/or 'iFrame1'
I can't put it on JSFiddle because my site heavily relies on images, so I'll just link you to where I have it uploaded: www.FeedtheSyrians.com
var divID = 'tabs' + i; if (divID !== null)... How would you expect it to be null when you've just assigned a string to it? You're supposed to performdocument.getElementByIdfirst, or just remove thatifstatement altogether.