javascript - Use the <select> tag to hold Integer to use in arithmetic -


i want have simple program calculates pre-defined values inserted in select tag , multiplies value of textbox (which converted integer) , prints inside "prod" textbox.

<script type="text/javascript">     //num2 id of select tag     var index = document.getelementbyid("num2").selectedindex;      //num1 id of textbox     //prod id of product textbox     function mul(){         var = parseint(document.getelementbyid("num1").value);         var b = document.getelementbyid("num2").value;         var c = document.getelementbyid("prod").value;         c.value=(a*b);     }  </script> 

i'm going nuts...

@bloodyknuckles correct, var b needs equal element, not value property of element.

working jsfiddle


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -