我的作业的最后一部分是我的头脑,我似乎无法将我的循环输出到文本框并输出10次任何帮助赞赏
function btnGenerate_onclick()
{
// assign textbox elements to variables for easier access
var outputTextbox = document.getElementById("txtOutput");
for(var i = 0; i < 10; i++)
{
var random = Math.floor(Math.random() * 24 + 8) ;
answer = (Math.pow(2, random));
}
outputTextbox.value = answer
}
答案 0 :(得分:0)
function btnGenerate_onclick () {
var answer, random;
// assign textbox elements to variables for easier access
var outputTextbox = document.getElementById("txtOutput");
for (var i = 0; i < 10; i++) {
random = Math.floor(Math.random() * 24 + 8) ;
answer = (Math.pow(2, random));
outputTextbox.value = outputTextbox.value + answer
}
}