Code:
<html>
<head>
<script type="text/javascript">
/*
Triple Combo Script Credit
By Philip M: http://www.codingforums.com/member.php?u=186
Visit http://javascriptkit.com for this and over 400+ other scripts
*/
var categories = [];
categories["startList"] = ["Apple","Samsung"]
categories["Apple"] = ["Iphone 5 16GB","Iphone 5 32GB","Iphone 5 64GB","Iphone 4S 16GB","Iphone 4S 32GB","Iphone 4S 64GB","Iphone 4 8GB","Iphone 4 16GB","Iphone 4 32GB"];
categories["Iphone 5 16GB"] = ["ATT","Verizon","Tmobile","Sprint"];
categories["ATT"] = ["NewInBox - $550.00","Good - $400.00","Cracked - $280.00","Broken - $225.00","Dead - $210.00"];
categories["Verizon"] = ["NewInBox - $550.00","Good - $400.00","Cracked - $280.00","Broken - $225.00","Dead - $210.00"];
categories["Tmobile"] = ["NewInBox - $350.00","Good - $300.00","Cracked - $280.00","Broken - $150.00","Dead - $120.00"];
categories["Sprint"] = ["NewInBox - $350.00","Good - $280.00","Cracked - $280.00","Broken - $170.00","Dead - $140.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 5 32GB"] = ["ATT","Verizon","Tmobile","Sprint"];
categories["ATT"] = ["NewInBox - $600.00","Good - $420.00","Cracked - $280.00","Broken - $225.00","Dead - $210.00"];
categories["Tmobile"] = ["NewInBox - $360.00","Good - $310.00","Cracked - $280.00","Broken - $150.00","Dead - $120.00"];
categories["Sprint"] = ["NewInBox - $360.00","Good - $290.00","Cracked - $280.00","Broken - $170.00","Dead - $150.00"];
categories["Verizon"] = ["NewInBox - $600.00","Good - $420.00","Cracked - $280.00","Broken - $225.00","Dead - $210.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 5 64GB"] = ["ATT","Verizon","Tmobile","Sprint"];
categories["Verizon"] = ["NewInBox - $700.00","Good - $440.00","Cracked - $280.00","Broken - $225.00","Dead - $210.00"];
categories["ATT"] = ["NewInBox - $700.00","Good - $440.00","Cracked - $280.00","Broken - $225.00","Dead - $210.00"];
categories["Tmobile"] = ["NewInBox - $370.00","Good - $320.00","Cracked - $280.00","Broken - $150.00","Dead - $120.00"];
categories["Sprint"] = ["NewInBox - $370.00","Good - $300.00","Cracked - $280.00","Broken - $170.00","Dead - $160.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 4S 16GB"] = ["ATT","Verizon","Sprint"];
categories["ATT"] = ["NewInBox - $400.00","Good - $280.00","Cracked - $250.00","Broken - $200.00","Dead - $90.00"];
categories["Sprint"] = ["NewInBox - $270.00","Good - $170.00","Cracked - $150.00","Broken - $120.00","Dead - $75.00"];
categories["Verizon"] = ["NewInBox - $270.00","Good - $210.00","Cracked - $170.00","Broken - $140.00","Dead - $75.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 4S 32GB"] = ["ATT","Verizon","Sprint"];
categories["Sprint"] = ["NewInBox - $280.00","Good - $170.00","Cracked - $150.00","Broken - $120.00","Dead - $75.00"];
categories["Verizon"] = ["NewInBox - $280.00","Good - $210.00","Cracked - $170.00","Broken - $140.00","Dead - $75.00"];
categories["ATT"] = ["NewInBox - $410.00","Good - $280.00","Cracked - $250.00","Broken - $200.00","Dead - $90.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 4S 64GB"] = ["ATT","Verizon","Sprint"];
categories["Verizon"] = ["NewInBox - $290.00","Good - $210.00","Cracked - $170.00","Broken - $140.00","Dead - $75.00"];
categories["ATT"] = ["NewInBox - $420.00","Good - $280.00","Cracked - $250.00","Broken - $200.00","Dead - $90.00"];
categories["Sprint"] = ["NewInBox - $290.00","Good - $170.00","Cracked - $150.00","Broken - $120.00","Dead - $75.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 4 8GB"] = ["ATT","Verizon","Sprint"];
categories["ATT"] = ["NewInBox - $220.00","Good - $160.00","Cracked - $110.00","Broken - $80.00","Dead - $50.00"];
categories["Sprint"] = ["NewInBox - $100.00","Good - $90.00","Cracked - $60.00","Broken - $45.00","Dead - $30.00"];
categories["Verizon"] = ["NewInBox - $100.00","Good - $90.00","Cracked - $60.00","Broken - $45.00","Dead - $30.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 4 16GB"] = ["ATT","Verizon"];
categories["ATT"] = ["NewInBox - $220.00","Good - $160.00","Cracked - $110.00","Broken - $80.00","Dead - $50.00"];
categories["Verizon"] = ["NewInBox - $100.00","Good - $90.00","Cracked - $60.00","Broken - $45.00","Dead - $30.00"];
/* --------------------------------------------------------------------- */
categories["Iphone 4 32GB"] = ["ATT","Verizon"];
categories["Verizon"] = ["NewInBox - $100.00","Good - $90.00","Cracked - $60.00","Broken - $45.00","Dead - $30.00"];
categories["ATT"] = ["NewInBox - $220.00","Good - $160.00","Cracked - $110.00","Broken - $80.00","Dead - $50.00"];
/* --------------------------------------------------------------------- */
/* ------ This is here for a place holder ----- */
categories["Samsung"] = ["Biography","Fiction","Nonfiction"];
categories["Biography"] = ["Contemporay","Historical","Other"];
categories["Fiction"] = ["Science Fiction","Romance", "Thrillers", "Crime"];
categories["Nonfiction"] = ["How-To","Travel","Cookbooks", "Old Churches"];
/* ------ End of place holder ------ */
var nLists = 4; // number of select lists in the set
function fillSelect(currCat,currList){
var step = Number(currList.name.replace(/\D/g,""));
for (i=step; i<nLists+1; i++) {
document.forms['tripleplay']['List'+i].length = 1;
document.forms['tripleplay']['List'+i].selectedIndex = 0;
}
var nCat = categories[currCat];
for (each in nCat) {
var nOption = document.createElement('option');
var nData = document.createTextNode(nCat[each]);
nOption.setAttribute('value',nCat[each]);
nOption.appendChild(nData);
currList.appendChild(nOption);
}
}
function getValue(L4, L3, L2, L1) {
alert("Your selection was:- \n" + L1 + "\n" + L2 + "\n" + L3 + "\n" + L4);
}
function init() {
fillSelect('startList',document.forms['tripleplay']['List1'])
}
navigator.appName == "Microsoft Internet Explorer" ? attachEvent('onload', init, false) : addEventListener('load', init, false);
</script>
</head>
<body>
<form name="tripleplay" action="">
<select name='List1' onchange="fillSelect(this.value,this.form['List2'])">
<option selected>Make a selection</option>
</select>
<select name='List2' onchange="fillSelect(this.value,this.form['List3'])">
<option selected>Make a selection</option>
</select>
<select name='List3' onchange="fillSelect(this.value,this.form['List4'])">
<option selected>Make a selection</option>
</select>
<select name='List4' onchange="getValue(this.value, this.form['List1'].value, this.form['List2'].value, this.form['List3'].value)">
<option selected >Make a selection</option>
</select>
</br>
</form>
</body>
</html>
Could it be a problem with duplicating data values? (I.E. I use "ATT" quite a bit, or all the carriers for that matter). If so, What would be a good fix? Or am I missing something that refreshes the logic to find the correct data?
Bookmarks