...

View Full Version : Drop-Down Menu Contest



raydin
12-30-2010, 03:01 AM
What I'm looking for is a series of related drop menus that change the strings involved based on customer’s choice and change the prices.
so it would need some sort of math functions..

so for example:
customer sees one drop down menu titled: manufacturers
once they choose something, the drop menu under it automatically populates new data

Manufacturers
• HTC
• Motorola
• Blackberry
• Nokia
• Sony
• LG
Network Providers:
• Rogers
• Fido
• AT&T
• Tmobile
• Telus
• Verizon
there would need to be if statements to cross reference, so
if(choice1==HTC && choice2==Rogers)
cost=15$;
else if (choice1== etc etc etc....)

Does anyone have any idea how to do this? I'm looking to have it in Java.

Regarding the contest, Help me decide what the prize will be. Smile

Thank you,

Has

jmrker
12-30-2010, 05:49 PM
Would need a bit more information than you have provided thus far.

1. Will all Manufacturers have access to ALL Network Providers or just SOME? If some, which?
2. What prices, or formula applied to a base price, will be applied to each combination?

I don't think your idea of numerous if statements is the best choice, but it could be done.

jmrker
12-30-2010, 06:45 PM
Major assumption coming ...

You need costs associated with DIFFERENT manufacturers and providers.

Change value to associate different providers with different manufacturers
and enter costs associated with the selections chosen as in example below.



<html>

<head>
<title>Product Price Data Collection</title>
<script type="text/javascript">
// From: http://www.codingforums.com/showthread.php?t=213522

function AddItems(Items,IDS) {
var sel = document.getElementById(IDS);
for (var i=0; i<Items.length; i++) {
// sel.options[sel.options.length]=new Option(Items[i],Items[i],true,true);
tmp = Items[i].split(':');
sel.options[sel.options.length]=new Option(tmp[0],tmp[1],true,true);
}
}
function Populate(IDS,Items) {
var sel = document.getElementById(IDS);
sel.options.length = 0; if (Items == '') { return; }
AddItems(['Select'],IDS);
var ItemArray = Items.split(',');
AddItems(ItemArray,IDS);
sel.selectedIndex = 0;
}

function showCost(info) { alert('Cost: $'+info); }

</script>
</head>

<body>
<form name="convert">

Manufacturer:
<select name="SBox1" id="SBox1" onChange="Populate('SBox2',this.value)">
<option value="">Choose Manufacturer</option>
<option value="Rogers:10,Fido:20,AT&T:30,Tmobile:40,Telus:50,Verizon:60">HTC</option>
<option value="Fido:10,AT&T:15,Tmobile:20,Telus:25,Verizon:30">Motorola</option>
<option value="AT&T:10,Tmobile:12,Telus:14,Verizon:16">Blackberry</option>
<option value="Tmobile:10,Telus:20,Verizon:30">Nokia</option>
<option value="Telus:10,Verizon:23">Sony</option>
<option value="Rogers:60,Fido:50,AT&T:40,Tmobile:30,Telus:20,Verizon:10">LG</option>
</select>

Provider:
<select name="SBox2" id="SBox2" onchange="showCost(this.value)"></select>
</form>
</body>

</html>

Old Pedant
12-30-2010, 06:51 PM
Does anyone have any idea how to do this? I'm looking to have it in Java.

Then you are posting in the wrong forum.

This is the JavaScript forum.

About the only thing Java and JavaScript have in common are the first 4 letters of their names.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum