<html> <head> <title>ThaiCreate.Com JavaScript Add/Remove Element</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <script language="javascript"> function CreateNewRow() { var intLine = parseInt(document.frmMain.hdnMaxLine.value); intLine++; var theTable = document.all.tbExp var newRow = theTable.insertRow(theTable.rows.length) newRow.id = newRow.uniqueID var item1 = 1 var newCell //*** ข้อที่ ***// newCell = newRow.insertCell(0) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<INPUT TYPE=\"TEXT\" SIZE=\"3\" NAME=\"Column1_"+intLine+"\" VALUE=\"\">" //*** ข้อกำหนด ***// newCell = newRow.insertCell(1) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<INPUT TYPE=\"TEXT\" SIZE=\"70\" NAME=\"Column2_"+intLine+"\" VALUE=\"\">" document.frmMain.hdnMaxLine.value = intLine; } function RemoveRow() { intLine = parseInt(document.frmMain.hdnMaxLine.value); if(parseInt(intLine) > 0) { theTable = (document.all) ? document.all.tbExp : document.getElementById("tbExp") theTableBody = theTable.tBodies[0]; theTableBody.deleteRow(intLine); intLine--; document.frmMain.hdnMaxLine.value = intLine; } } </script> <body> <form name="frmMain" action="test3.php"method="post"> <table width="50%" border="1" cellspacing="0" cellpadding="0"> <tr> <th width="22%" scope="row">มาตราที่: <input name="txtID" type="text" value="" size="9"> </th> <td width="78%">รายละเอียด <input name="txtDetail" type="text" size="60"></td> </tr> <tr> <th scope="row"> </th> <td><div ><table width="445" border="1" id="tbExp"> <tr> <td width="89"><div align="center">ข้อที่</div></td> <td width="340"><div align="center">ข้อกำหนด </div></td> </tr> </table> <input type="hidden" name="hdnMaxLine" value="0"> <input name="btnAdd" type="button" id="btnAdd" value="+" onClick="CreateNewRow();"> <input name="btnDel" type="button" id="btnDel" value="-" onClick="RemoveRow();"> </div></td> </tr> </table> <input type="hidden" name="line" value="intLine"> <input name="sub" type="submit" value="submit"> </form> <?php $intLine="<script>document.write(intLine)</script>"; echo $intLine; ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง