Using HTML, and embedding JavaScript (feel free to go about this however you wan
ID: 3850991 • Letter: U
Question
Using HTML, and embedding JavaScript (feel free to go about this however you want, node.js, etc) within, create a table of severals rows and columns. Each rows first column is a checkbox column, in which the user can select certain lines as they please. When the user is done selecting their rows that they want, they hit a "submit" button. Please write an HTML/javascript file that writes to a new text file all of the data from the entire row, from the lines, and only the lines, that the user had checked. Below is an example of lines that are checked, which in that scenario, would be the material to be written to the text file.
So for example as seen here, there are four columns other than the checkbox column. For the user checked rows, please make sure ALL the columns are being written to the textfile.
***************Note: The attached image is simply for reference / clarification of any confusion. You do not have to exactly replicate the photo
Select Line Number 0930:37 13 15 Machine type Date Log segment 3.04.00 date & time: Log Info Log 03-29-15 00 0x000004A2 1 03-29-15 Tasks art 03-29-15 03-29-15 (950201 0x00000BD8 (c707 Task End 03-29-15 (9602) 0x00000ABE BKUPSTRT 03-29-15 (150c) l 0x00000AEC BKPFILESIZE 03-29-15 (97020 I0x00000B8F (40c) 0x00000BED 03-29-15 BACKUPDONE (c507 0x00000C71 TaskStart (c707 l 0x00000E34 Task End 03-29-15 con 15 (0a0301 0x0000102B ASEMIRRST 03-29-15 (9502) 0x00001161 CM XMITWAKE (9502) |0x00001314 03-29-15 (9502) 10x000013A4 (9502) |0x000013FFExplanation / Answer
<html>
<body>
<table id="Item1">
<tr>
<td>table row1</td>
<td>
<input name="rowno" type="checkbox" />
</td>
</tr>
<tr>
<td>table row2</td>
<td>
<input name="rowno" type="checkbox" />
</td>
</tr>
<tr>
<td>table row3</td>
<td>
<input name="rowno" type="checkbox" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="button" id="button" value="Submit" />
</td>
</tr>
</table>
<script>
function whichRow(tableID) {
var tableData = document.getElementById(tableID);
var rowCount = tableData.rows.length;
var output = tableData.getElementsByTagName('input');
for (var i = 0; i < rowCount - 1; i++) {
if (output[i].checked) {
var cell_val = tableData.rows[i].cells[0].innerHTML;
alert(cell_val);
}
}
}
</script>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.