0

我无法将下面的最终函数 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 
 }
4

1 回答 1

0

我不太确定你要做什么,但很少有事情会弹出。我建议你var testarray = new Array();在任何函数之外声明。然后在
function addData()
{
testarray.push (window.prompt("Enter a letter"));
}

variableTest() 应该做什么?

调用 addDate 时是否应该将提示文本添加到该表中的单元格中?

于 2010-01-25T19:51:34.953 回答