SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Scratching head... NEED HELP!
-
Sep 17, 2001, 12:38 #1
- Join Date
- Aug 2000
- Posts
- 248
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Scratching head... NEED HELP!
I have the following so far: Changing the choice selected in the select menu item created in the following code updates the "total" field. I need a way to multiply the quantity field times the selection field so that it updates the total field.
<html>
<head>
<script>
var _next=0
var test=(_next++);
var hello=(_next++);
var again=(_next++);
var YOOHOO=(_next++);
var YEEHAA=(_next++);
var prices = new Array();
prices[test]="40.00";
prices[hello]="30.00";
prices[again]="20.00";
prices[YOOHOO]="10.00";
prices[YEEHAA]="5.00";
</script>
</head>
<body>
<form name=exf1>
Quantity:
<input type="text" name="Ticket_Qty" tabindex="12" size="6" maxlength="3"><br><br>
Select Item:
<select name="Sections" onchange="updatePrice()" tabindex="14">
<option value="0" selected>Select One</option>
<option value="test">A Section $40</option>
<option value="hello">B Section $30</option>
<option value="again">C Section $20</option>
<option value="YOOHOO">1st Balcony $10 (Gusman only)</option>
<option value="YEEHAA">Second Balcony $5 (Gusman only)</option>
</select><BR><BR>
Total:
<input type=text name=t1 value="?">
</form>
<script>// set up the data to be consistent to start with.
document.exf1.Sections.selectedIndex=0;
document.exf1.t1.value=prices[0];
function updatePrice() {
var _v = document.exf1.Sections.selectedIndex;
var _x = document.exf1.Sections[_v].value;
var _y = eval(_x);
document.exf1.t1.value=prices[_y];
}
</script>
</body>
</html>
-
Sep 17, 2001, 15:44 #2
- Join Date
- Sep 2001
- Location
- Barrie, Ontario
- Posts
- 324
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is this more what you are looking for - demo ?
-
Sep 17, 2001, 19:13 #3
- Join Date
- Aug 2000
- Posts
- 248
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
THANKS!!!
All I can say is thank you, thank you and more thank you
I was trying to create that for 3 hours now.
did I say thanks???excellent place this is.
Bookmarks