javascript - how to display the product of checkbox and dropdown list in number box -



javascript - how to display the product of checkbox and dropdown list in number box -

here catalogue codes. want display value of checkbox multiplied value of dropdown list , output product . html , javascript codes used.

<table align=center border=1> <tr colspan=3> <td colspan=3><h2>specialty cakes</h2></td> </tr> <tr> <td><img src=special\blackforest_small.jpg valign=center-right><br><center>black forest</td> <td>chocolate sponge layered sugar syrup , kirsch flavouring, white mousse , dark sweetness cherries.</td> <td><input type="checkbox" id="check1" name="check1" value="550.00"onclick="product1()">buy p550.00</input><br><input type="number" id="total1" name="total1" value="p0.00"size="8"></input><br> qty: <select id="qty1" name="qty1" onchange="product1()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> </select> </td> </tr> </table> <script> var m = document.getelementbyid("check1").checked; function product1(){ var x = document.getelementbyid("check1").value; var y = document.getelementbyid("qty1").value; var z = 0; if (m = true){ z = "p" + x * y; } document.getelementbyid("total1").value = z; } </script>

you have input id total1 type = number - assigning text value of p0.00 alter type text , work, or give numeric value.

javascript html

Comments

Popular posts from this blog

c# - ASP.NET MVC Sequence contains no matching element -

java - Parsing XML, skip certain tags -

rest - How to invalidate user session on inactivity in a stateless server? -