我的代码是这样的:
<script language="Javascript" type="text/javascript">
var input;
var w1,w2,w3,w4,w5,w6,w7,w8,w9,w10;
var w1 = ' ';
var w2 = ' ';
var w3 = ' ';
var w4 = ' ';
var w5 = ' ';
var w6 = ' ';
var w7 = ' ';
var w8 = ' ';
var w9 = ' ';
var w10 = ' ';
do {
alert("Enter 10 words");
w1 = prompt("Enter First Word", " ");
w2 = prompt("Enter Second Word", " ");
w3 = prompt("Enter Third Word", " ");
w4 = prompt("Enter Fourth Word", " ");
w5 = prompt("Enter Fifth Word", " ");
w6 = prompt("Enter Sixth Word", " ");
w7 = prompt("Enter Seventh Word", " ");
w8 = prompt("Enter Eighth Word", " ");
w9 = prompt("Enter Nineth Word", " ");
w10 = prompt("Enter Tenth Word", " ");
} while(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10 == " ");
var myWords = new Array(10);
myWords[0] = w1;
myWords[1] = w2;
myWords[2] = w3;
myWords[3] = w4;
myWords[4] = w5;
myWords[5] = w6;
myWords[6] = w7;
myWords[7] = w8;
myWords[8] = w9;
myWords[9] = w10;
for(i = 0; i < myWords.length; i++) {
document.write(myWords[i] + "<br/>");
}
document.write(myWords[0] + "<br/>");
document.write(myWords[1] + " " + myWords[2] + "<br/>");
document.write(myWords[3] + " " + myWords[4] + " " + myWords[5] + "<br/>");
document.write(myWords[6] + " " + myWords[7] + " " + myWords[8] + " " + myWords[9] + "<br/>");
</script>
如何将其更改为一个 prompt() 而不是十个?