tags:

views:

139

answers:

1

having trouble putting together the final function displayLetter(a,b,c,d,e,f,g) and writing to table with innerHTML with array element and variables in variableTest() I know I need to use .length and to determine how many cells I need. W3C only gets me so far. Thanks for the help!

 <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>

MY 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)
 {

 }
A: 

Hi. I'm not quite sure what you are trying to do but few things pop out. I'd suggest you declare var testarray = new Array(); outside of any function. Then in
function addData()
{
testarray.push (window.prompt("Enter a letter"));
}

What is variableTest() supposed to do?

When calling addDate is it supposed to add the prompted text into a cell in that table?

Eino T