我无法将下面的最终函数 displayLetter(a, b, c, d, e,f, g) 放在一起,并使用 variableTest() 中的数组元素和变量写入 innerHTML 中的表。我知道我需要使用 .length 并确定我需要多少个单元格。W3C 只能让我到目前为止。谢谢您的帮助!
<html>
<head>
<title>
</title>
<script>
</script>
</head>
<body>
<h1>TEST THIS SCRIPT</h1>
<table border="1">
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>
<th>E</th>
<th>F</th>
<th>G</th>
</tr>
<a href="add data" id="reload">Add Employee</a>
</body>
<html>
我的 JS:
function addData()
{
var testarray = new Array();
testarray[0] = window.prompt("Enter a letter", "z");
variableTest(x, y);
displaySalary(a, b, c, d, e, f, g);
}
function variableTest(x, y)
{
a=1;
b=2;
c=3;
d=4;
e=5;
}
displayLetter(a, b, c, d, e, f, g)
{
// Code to write the variables to the table
}