Im trying to figure out how to use checkboxes to add rows (up to five) to an existing table, heres the html,
[code=html]
<form name=”myform”>
Row 1 <input type=”checkbox” name=”check_list” onClick=”addRow(1)”><br>
Row 2 <input type=”checkbox” name=”check_list” onClick=”addRow(3)”><br>
Row 3 <input type=”checkbox” name=”check_list” onCheck=”addRow(3)”><br>
Row 4 <input type=”checkbox” name=”check_list” onCheck=”addRow(4)”><br>
Row 5 <input type=”checkbox” name=”check_list” onCheck=”addRow(5)”><br>
<button type=”button”onClick=”CheckAll(document.myform.check_list)”>Check All</button>
<button type=”button” onClick=”UnCheckAll(document.myform.check_list)”>Unheck All</button>
</form>
<table id=”dynamo” align=”center” border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<th> </th>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</table>
heres the function to create the row
[CODE]
function addRow(x)
{
var mytable = document.getElementById(“dynamo”);
var row=document.createElement(“tr”);
var col1=document.createElement(“td”);
var rowcount=document.createTextNode(“Row “+x);
var col2=document.createElement(“td”);
var col3=document.createElement(“td”);
var col4=document.createElement(“td”);
col1.appendChild(rowcount);
mytable.appendChild(row);
mytable.appendChild(col1);
mytable.appendChild(col2);
mytable.appendChild(col3);
mytable.appendChild(col4);
}
I’m trying to get all the borders to show (even the tds with no content)
Also, im trying to toggle the rows, so if the box isn’t checked the row goes away.
[ATTACH]16159[/ATTACH]
Thanks…
[canned-message]attachments-removed-during-migration