G
Gregc.
Hi Again
I am trying to get this conditionals statement to work. Basically, if
the op clicks 1-5, then it prints the qty in the qty box, and the name
of the pizza in the pizza box. If the op clicks on 0, then the order
for that product is removed. If clicks on the changes the order ie
qty, then the new qty appears. The orders appear one after another.
For some reason I can select on the qty and that qty won't appear int
the orderqty select box. Here is the code:
<html>
<head>
<script type="text/javascript">
function updateOrder(obj){
var codesInlist= obj.options.length;
var type = obj.name;
var pizza= new Array("Supreme", 12);
var pizza2 = new Array("Italian",12);
var w=obj.selectedIndex;
var selected_text = obj.options[w].text;
var qty1=document.getElementById("orderQty");
var piz1=document.getElementById("PizzaType")
var clearqty1 =qty1.options.length = 0;
var clearName1 = piz1.options.length=0;
//Tests to see if the pizza type is supreme
if(type==pizza[0]){
if(w == 0){
clearqty1;
clearName1;}
else{
// adds the number selected to the select box
qty1.options[qty1.options.length] = new Option(selected_text);
piz1.options[piz1.options.length]=new Option(pizza[0])
}
}
//Tests to see if the pizza type is Italian
if(type==pizza2[0]){
if(w == 0){
clearqty1;
clearName1;
}
else{
// adds the number selected to the select box
qty1.options[qty1.options.length] = new Option(selected_text);
piz1.options[piz1.options.length]=new Option(pizza2[0])
}
}
}
</script>
</head>
</script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"
style="text-align:center">
<form name="form1" method="post" action="" onsubmit="">
<select name="Supreme" id="Supreme" onchange="updateOrder(this);">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"
style="text-align:center">
<form name="form1" method="post" action="" onsubmit="">
<select name="Italian" id="Italian" onchange="updateOrder(this);">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<td bgcolor="#FFE9BB" class="borderBR"><select name="Type of Pizza"
size="10" id="PizzaType">
<option>Pizza Ordered</option>
</select> </td>
<td bgcolor="#FFE9BB" class="borderBR"><select name="orderQty" size="4"
multiple="multiple" id="orderQty">
</select>
</body>
</html>
Greg
I am trying to get this conditionals statement to work. Basically, if
the op clicks 1-5, then it prints the qty in the qty box, and the name
of the pizza in the pizza box. If the op clicks on 0, then the order
for that product is removed. If clicks on the changes the order ie
qty, then the new qty appears. The orders appear one after another.
For some reason I can select on the qty and that qty won't appear int
the orderqty select box. Here is the code:
<html>
<head>
<script type="text/javascript">
function updateOrder(obj){
var codesInlist= obj.options.length;
var type = obj.name;
var pizza= new Array("Supreme", 12);
var pizza2 = new Array("Italian",12);
var w=obj.selectedIndex;
var selected_text = obj.options[w].text;
var qty1=document.getElementById("orderQty");
var piz1=document.getElementById("PizzaType")
var clearqty1 =qty1.options.length = 0;
var clearName1 = piz1.options.length=0;
//Tests to see if the pizza type is supreme
if(type==pizza[0]){
if(w == 0){
clearqty1;
clearName1;}
else{
// adds the number selected to the select box
qty1.options[qty1.options.length] = new Option(selected_text);
piz1.options[piz1.options.length]=new Option(pizza[0])
}
}
//Tests to see if the pizza type is Italian
if(type==pizza2[0]){
if(w == 0){
clearqty1;
clearName1;
}
else{
// adds the number selected to the select box
qty1.options[qty1.options.length] = new Option(selected_text);
piz1.options[piz1.options.length]=new Option(pizza2[0])
}
}
}
</script>
</head>
</script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"
style="text-align:center">
<form name="form1" method="post" action="" onsubmit="">
<select name="Supreme" id="Supreme" onchange="updateOrder(this);">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"
style="text-align:center">
<form name="form1" method="post" action="" onsubmit="">
<select name="Italian" id="Italian" onchange="updateOrder(this);">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<td bgcolor="#FFE9BB" class="borderBR"><select name="Type of Pizza"
size="10" id="PizzaType">
<option>Pizza Ordered</option>
</select> </td>
<td bgcolor="#FFE9BB" class="borderBR"><select name="orderQty" size="4"
multiple="multiple" id="orderQty">
</select>
</body>
</html>
Greg