这是我的代码我不知道为什么我的提示无效。我有两个函数,一个调用另一个。但是我的提示框不会出现:
<script type="text/javascript">
**here is the function I want to call using the second function place values.
function square()
{
cells = new Array([document.getElementById("cell00"),document.getElementById("cell01"),document.getElementById("cell02"),document.getElementById("cell03")],
[document.getElementById("cell10"),document.getElementById("cell11"),document.getElementById("cell12"),document.getElementById("cell13")],
[document.getElementById("cell20"),document.getElementById("cell21"),document.getElementById("cell22"),document.getElementById("cell23")] );
placevalues();
}<!--square function end-->
function placevalues()
{
for (var rows=0;rows<4;rows++)
{
for (var cols=0;cols<4;cols++)
{
cells[rows][cols].innerHTML = prompt("Enter a number for row "+row+"column "+cols);
} <!--end of second for loop-->
}<!--end of for loop-->
}<!--end of placevalues function-->
调用函数的地方:
<h3>
<input type="button" value="Check if its a magic square" onclick="square()"/><br>
</h3>
<!--buttons that will be press to initiate the loops-->