Skip to content

Instantly share code, notes, and snippets.

@erkantaylan
Last active December 20, 2015 20:01
Show Gist options
  • Select an option

  • Save erkantaylan/5c76747fce4052a601c1 to your computer and use it in GitHub Desktop.

Select an option

Save erkantaylan/5c76747fce4052a601c1 to your computer and use it in GitHub Desktop.
<!DOCTYPE hmtl>
<html>
<head>
<title>Task Manager</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
.selection_checkbox:checked + .selection_label {
text-decoration:line-through;
}
input[type="checkbox"][checked] {text-decoration:line-through}
.strikethrough:checked + span{
text-decoration:line-through
}
</style>
<script>
function overLine(){
window.alert("sometext");
var input = document.getElementById ("sila");
var isChecked = input.checked;
isChecked = (isChecked)? "checked" : "not checked";
alert ("The checkBox is " + isChecked);
}
function over(){
if(document.getElementById("sila").checked ){
document.getElementById("txt").style.textDecoration = "line-through";
}
}
function s(){
if (document.getElementById('sila').checked)
{
document.getElementById('txt').value = 10;
}
}
function y(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length ;
var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0);
cell1.innerHTML = rowCount + 1 - 1;
var cell2 = row.insertCell(1);
var element2 = document.createElement("input");
element2.setAttribute("type","checkbox");
element2.id="sila";
element2.name="chkbox[]";
element2.onclick="over()";
cell2.appendChild(element2);
element2.onchange = overLine;
var cell3 = row.insertCell(2);
var element3 = document.createElement("input");
element3.type = "datetime-local";
cell3.appendChild(element3);
var cell4 = row.insertCell(3);
var element4 = document.createElement("input");
element4.id="txt";
element4.type = "text";
element4.setAttribute('contenteditable', 'true');
cell4.appendChild(element4);
}
function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length - 1;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[1].childNodes[0];
if(null != chkbox && true == chkbox.checked ) {
table.deleteRow(i);
rowCount--;
i--;
}
}
}catch(e) {
alert(e);
}
}
</script>
</head>
<body>
<button type="button" onclick="y('table')">Add</button>
<button type="button" onclick="deleteRow('table')">Delete</button>
<table border="1" id="table">
<tr bgcolor="#66CC99">
<th>Task No</th>
<th>Done/In Progress</th>
<th width="190">Deadline</th>
<th width="180">Task</th>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment