|
|
|
ต้องการโค้ดปุ่มเพิ่มคอลั่มน์ สำหรับตารางกรอกคะแนนค่ะ |
|
|
|
|
|
|
|
เพิ่มคอลัมน์ตัองวนลูปเพิ่มที่ละแถว
|
|
|
|
|
Date :
2017-09-10 11:13:04 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Insert Column/Row</title>
<script src="asset/js/jquery-1.11.3.min.js"></script>
<script>
$(document).ready(function(e) {
$('#addcolumn').click(function(e) {
$('tr').each(function(idx, tr){
var isTH=$(tr).find('th').length>0;
var col=isTH? '<th>new column th</th>' : '<td>new column td</td>';
$(tr).find((isTH? 'th':'td')+':last').before(col);
});
});
$('#addrow').click(function(e) {
var tr=$('tr:last').clone();
tr.find('td').html('new row');
tr.find('td:last').html('');
var clonelast='<tr>'+$(tr).html()+'</tr>';
//alert(clonelast);
$('tr:last').before(clonelast);
});
});
</script>
</head>
<body>
<table border="1">
<tr><th>Column1</th><th>Column2</th><th id="addcolumn" >New Column</th></tr>
<tr><td>Test1</td><td>test2</td><td></td></tr>
<tr><td id="addrow" ><b>New Row</b></td><td></td><td></td></tr>
</table>
</body>
</html>
|
|
|
|
|
Date :
2017-09-10 16:04:27 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2017-09-12 16:39:18 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|