I am hoping that someone can help me fix some pretty simple code.
I am building a web page that has tab panels that hide and show information depending on which one is selected. I am trying to make horizontal tabs at the top of the page.
I have had some success, however I am having two problems:
The first problem is that one of the tabs doesn't work (specifically tab 4 "videos").
The other is that when you first start up the page, there are three tabs highlighted (1, 4 and 5), however there should only be 1 tab highlighted (tab1).
I have included my code below. Can anyone tell me where my mistakes are?
Thank you!!!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" language="JavaScript"><!--
function ManageTabPanelDisplay() {
var idlist = new Array('tab1focus','tab2focus','tab3focus','tab4focus', 'tab5focus','tab1ready','tab2ready','tab3ready','tab4ready', 'tab5ready','content1','content2','content3','content4','content5');
// No other customizations are necessary.
if(arguments.length < 1) { return; }
for(var i = 0; i < idlist.length; i++) {
var block = false;
for(var ii = 0; ii < arguments.length; ii++) {
if(idlist[i] == arguments[ii]) {
block = true;
break;
}
}
if(block) { document.getElementById(idlist[i]).style.display = "block"; }
else { document.getElementById(idlist[i]).style.display = "none"; }
}
}
//--></script>
I couldn't see what is wrong with your other code at first glance. Do you have a live link to look at? Also please use the appropriate tags for code so it is easier to look at. Additionally, this is a javascript issue not an HTML one, please post to the appropriate forum next time (since you are more likely to get a quicker response).
Bookmarks