View Full Version : guys, help with code please.

12-31-2005, 10:04 AM
i have a nice script which show me plan details.
but it was developed only for 2 plans.
in my service i have about 5 plans.
how its possible to add more plans to this javascript?

please help with it.

<script language="javascript" type="text/javascript">

function flipTerabyte(isTerabyte) {
if ((isTerabyte) && document.getElementById("terabytePlans").style.display == "") return;
if ((!isTerabyte) && document.getElementById("gigabytePlans").style.display == "") return;

if (isTerabyte) {
document.getElementById("gigabytePlans").style.display = "none";
document.getElementById("terabytePlans").style.display = "";

else {
document.getElementById("terabytePlans").style.display = "none";
document.getElementById("gigabytePlans").style.display = "";


<a href="#" onClick="flipTerabyte(false);return false" style="text-decoration:none;">plan1</a>
<a href="#" onClick="flipTerabyte(true);return false" style="text-decoration:none;">plan2</a>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="gigabytePlans">
<td>plan1 details</td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="terabytePlans" style="display:none">
<td>plan2 details</TD></TR>

12-31-2005, 10:59 AM
var tableArray = new Array('table1', 'table2', 'table3', 'table4', 'table5');

function showTable(which) {
var tempTable = document.getElementById(tableArray[which]);
tempTable.style.display = 'block'; //or ''

function hideAll() {
for(var ArrayIndex=0; ArrayIndex<5; ArrayIndex++) {
document.getElementById(tableArray[ArrayIndex]).style.display = 'none';


<table id="table1"><tr><td>plan1 details</td></tr></table>
<table id="table2"><tr><td>plan2 details</td></tr></table>
<table id="table3"><tr><td>plan3 details</td></tr></table>
<table id="table4"><tr><td>plan4 details</td></tr></table>
<table id="table5"><tr><td>plan5 details</td></tr></table>


<a href="#" onClick="showTable('0');return false">plan1</a>
<a href="#" onClick="showTable('1');return false">plan2</a>
<a href="#" onClick="showTable('2');return false">plan3</a>
<a href="#" onClick="showTable('3');return false">plan4</a>
<a href="#" onClick="showTable('4');return false">plan5</a>

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum