I am a beginner in JavaScript.
(我是JavaScript的初学者。)
I have a table which shows details of a bill.(我有一张桌子,上面有帐单的细节。)
Quantity can be filled in the form.(数量可以填写在表格中。)
Once I enter the quantities and submit the form, the bill will be calculated and display the price of each type, and the total.(输入数量并提交表格后,将计算账单并显示每种类型的价格以及总计。)
So how to insert values from input into an array?(那么如何将输入中的值插入数组呢?)
<!--//Script.js document.writeln("<table name=\"bill\" style=\"text-align:center\"><tr><th>Ice cream type</th><th>Name</th><th>Unit Price</th><th>quantity</th><th>Total</th><tr>"); var type = ["vanilla", "chocolote", "mango", "Butterscotch"]; var data = [70, 60, 80, 100]; for (var i = 0; i < 4; i++) { document.writeln("<tr><td id=\"dx\" width=" + 200 + "px>type " + (i + 1) + "</td><td width=" + 100 + "px>" + type[i] + "</td><td>" + data[i] + "</td><td><input type=text></td><td id=a></td></tr>"); } document.writeln("<tr ></tr><td id=p1 colspan=4 style=\"text-align:right\">total</td><td ></td></table>"); function myfunc() { } //-->
<h1 style="text-align:center">The Ice-Cream Shop</h1> <center> <p id="demo"></p> <script type="text/javascript" src="Script.js"> </script> <p><input type=button value=submit> <input type=button value=clear onclick="myfunc()"></p> <p id=x></p> </center>
ask by Aye translate from so