I'm having trouble creating a very simple running total of a
few drop down list. I have three seperate dropdown lists, I
want the user to simply select some numbers and have the
total of the selected numbers displayed.
I'm not much of a programmer and this is really just a
experiment. Can anyone help me out here. I know the code
below doesnt work (no form tags etx0 but I thought the logic
was fine?
Example of what I would like to happen
User selects 2,5,6 and a total of 13 is displayed somewhere
on the page. This total changes when the user picks
different numbers.
Can anyone help me out here?
------------------------------------------------------------
--------
Code
</head>
<script language="javascript">
function workit()
{
var itemA=document.select.value
var itemB=document.select2.value
var itemC=document.select3.value
var total = itemA+itemB+itemC;
}
</script>
<body>
<p>
<select name="select" onChange="workit()">
<option value="1" selected>One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<select name="select2" onChange="workit()">
<option value="4" selected>Four</option>
<option value="5">Five</option>
<option value="6">Six</option>
</select>
<select name="select3" onChange="workit()">
<option value="7" selected>Seven</option>
<option value="8">Eight</option>
<option value="9">Nine</option>
</select>
</p>
<p><span id=mytotal></span></p>
</body>
</html>