我试图创建一个程序,用户可以输入他们想要输入的CD数量,然后将他们输入的内容打印到屏幕上。
有没有办法在一个提示框中启用多个条目?
<script language="JavaScript">
var titleCD = [];
var costCD = [];
var subTotal = [];
var entries = parseInt(prompt("How many CDs do you wish to enter?",0));
while(entries>0) {
titleCD = prompt("What is the title of your CD?");
costCD = parseInt(prompt("What is the cost of that CD?", 0));
entries--;
}
b = new String(titleCD + ": " + "£" + costCD + "<br>");
document.write(b.bold());
u = new String("The subtotal cost of all CDs is: £" + subTotal);
document.write(u.toUpperCase());
</script>