i have a form that has 3 select box and an input type text that determines the no of selected item, if the user selects ‘N/A’ it is considered not selected
for example
item 1 = 4
item 2 = N/A
item 3 = 3
no of items selected = 2
if the item 1 has been changed to ‘N/A’, the no of items selected = 1 and if the user again changed the item 2 to 5, the no of items selected will be back to 2,
how will i code this in javascript, i know that i should use the onChange property of the select box, here is my sample html, i hope someone could help me, thanks in advance…
<html>
<HEAD>
<TITLE>JavaScript</TITLE>
</HEAD>
<BODY>
<H2>Determine the no of items</H2>
<select name=option1 onChange=”go()”>
<option value=”>— Select —
<option value=”0″>N/A
<option value=”1″>1
<option value=”2″>2
<option value=”3″>3
<option value=”4″>4
<option value=”5″>5
</select>
<br />
<select name=option2 onChange=”go()”>
<option value=”>— Select —
<option value=”0″>N/A
<option value=”1″>1
<option value=”2″>2
<option value=”3″>3
<option value=”4″>4
<option value=”5″>5
</select>
<br />
<select name=option3 onChange=”go()”>
<option value=”>— Select —
<option value=”0″>N/A
<option value=”1″>1
<option value=”2″>2
<option value=”3″>3
<option value=”4″>4
<option value=”5″>5
</select>
<br>
<input type=”text” id=”no_of_items” name=”no_of_items” value=”0″ readonly>
</form>
</BODY>
</HTML>