Javascript & JQuery & CSS > example - Table ¿¹Á¦ (Çà Ãß°¡/»èÁ¦)
µî·ÏÀÏ : 2017-07-04 18:13
Á¶È¸¼ö : 53,736
<script type="text/javascript">
<!--
var task_count=1;
function fnc_table_delete(e)
{
var obj = find_parent_tag(e,'td');
if(obj.parentNode)
var idx = obj.parentNode.rowIndex;
else
var idx = obj.parentElement.rowIndex;
var tRow = tb1_task.deleteRow(idx);
task_count--;
}
function find_parent_tag(e,tag){
if(e.target)
var obj = e.target
else
var obj = e.srcElement
while (obj.tagName.toLowerCase() != tag)
{
if(obj.parentNode)
obj = obj.parentNode
else
obj = obj.parentElement
if(typeof(obj.tagName)=='undefined') break;
}
return obj
}
function fnc_table_insert() {
task_count++;
if(document.getElementById){
var Tbl = document.getElementById('tb1_task');
} else {
var Tbl = document.all['tb1_task'];
}
var tRow = Tbl.insertRow(-1);
var tmp=tRow.insertCell(0);
tmp.innerHTML ='<input type="text" name="part[]" value="" size="15" maxlength="30">';
tmp.align='center';
tmp=tRow.insertCell(1);
tmp.innerHTML ='<input type="text" name="hakyear[]" value="" size="5" maxlength="1">';
tmp.align='center';
tmp=tRow.insertCell(2);
tmp.innerHTML ='<input type="text" name="hakbun[]" value="" size="10" maxlength="10">';
tmp.align='center';
tmp=tRow.insertCell(3);
tmp.innerHTML ='<input type="text" name="name[]" value="" size="10" maxlength="30">';
tmp.align='center';
tmp=tRow.insertCell(4);
tmp.innerHTML ='<input type="text" name="tel[]" value="" size="10" maxlength="30">';
tmp.align='center';
tmp=tRow.insertCell(5);
tmp.innerHTML ='<input type="button" value="»èÁ¦" class="btn_all_sellect" onClick="fnc_table_delete(event)">';
tmp.align='center';
}
-->
</script>
<table border=1 width="700" id="tb1_task">
<tr>
<th>ÇкÎ(°ú, Àü°ø)</th>
<th>Çгâ</th>
<th>Çйø</th>
<th>¼º¸í</th>
<th>¿¬¶ôó</th>
<th>Ãß°¡</th>
</tr>
<tr>
<td><input type="text" name="mem_school[]" value="" class='Wid60 mWid10' size="15" maxlength="30"></td>
<td><input type="text" name="mem_class[]" value="" class='Wid60 mWid10' size="5" maxlength="1" style="ime-mode:disabled"></td>
<td><input type="text" name="memb_no[]" value="" class='Wid60 mWid10' size="10" maxlength="10" style="ime-mode:disabled"></td>
<td><input type="text" name="mem_name[]" value="" class='Wid60 mWid10' size="10" maxlength="30"></td>
<td><input type="text" name="mem_tel[]" value="" class='Wid60 mWid10' size="10" maxlength="30"></td>
<td>
<input type="button" value="Ãß°¡" class="btn_all_sellect" onClick="fnc_table_insert()"></td>
</tr>
</table>