samedi 14 mars 2015

Create a table with value from checkboxes

I have this question in my assignment:


Show the elements number and value of the six checkboxes in a six-row, two-column table with a 2 pixel border in the span block with id="ans18"


This is what I have so far:



o = "<table border = 2>";
for(i = 5; i <= 10; i++)
{
o += "<tr>";
for(j = 0; j < 1; j++)
{
o += "<td>" + document.alice.element[i] + "</td>" + "<td>" + i + "</td>";
}
o += "</tr>";
}
o += "</table>";
ans18.innerHTML = o;


The checkboxes that I have to look at have the names c1-c6, with elements 5-10 and values of "K","M","O","C","L","T" in that order.


I know problem with my code is this line



o += "<td>" + document.alice.element[i] + "</td>" + "<td>" + i + "</td>";


I just don't know why.Please help! Also, it has to be in JavaScript





Aucun commentaire:

Enregistrer un commentaire