var intLine = 1; function CreateNewRow() { var intLine = parseInt(document.form1.hdnMaxLine.value); intLine++; var theTable = document.all.tbExp var newRow = theTable.insertRow(theTable.rows.length) newRow.id = newRow.uniqueID var item1 = 1 var newCell //*** Column 1 ***// newCell = newRow.insertCell(0) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = " <tr><td><div align=center><INPUT TYPE=\"TEXT\" SIZE=\"7\" NAME=\"item19"+intLine+"\" VALUE=\"\" CLASS=\"textb11\" ID=\"item19\"></div></td>" //*** Column 2 ***// newCell = newRow.insertCell(1) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<td><div align=center><INPUT TYPE=\"TEXT\" SIZE=\"60\" MAXLENGTH=\"45\" NAME=\"desc19"+intLine+"\" VALUE=\"\" CLASS=\"textb11\" ID=\"desc19\"></div></td>" //*** Column 3 ***// newCell = newRow.insertCell(2) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<td><div align=center><INPUT TYPE=\"TEXT\" SIZE=\"20\" NAME=\"quantity19"+intLine+"\" VALUE=\"\" CLASS=\"textb11\" onkeyup=\"calAmount2()\" ID=\"quantity19\"></div></td>" //*** Column 4 ***// newCell = newRow.insertCell(3) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<td><div align=center><INPUT TYPE=\"TEXT\" SIZE=\"7\" NAME=\"unit173"+intLine+"\" VALUE=\"\" CLASS=\"textb11\" ID=\"unit173\"></div></td>" //*** Column 5 ***// newCell = newRow.insertCell(4) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<td><div align=center><INPUT TYPE=\"TEXT\" SIZE=\"8\" NAME=\"unit_price19"+intLine+"\" VALUE=\"\" CLASS=\"textb11\" ID=\"unit_price19\"></div></td>" newCell = newRow.insertCell(5) newCell.id = newCell.uniqueID newCell.setAttribute("className", "css-name"); newCell.innerHTML = "<td><div align=center><INPUT TYPE=\"TEXT\" SIZE=\"20\" NAME=\"amount19\" VALUE=\"0\" CLASS=\"textb11\" onblur=\"calTotal()\" ID=\"amount19"+intLine+"\"></div></td></tr>" document.form1.hdnMaxLine.value = intLine; } function calTotal(){ var a1=document.form1.amount1.value; var a2=document.form1.amount2.value; var a3=document.form1.amount3.value; var a4=document.form1.amount4.value; var a5=document.form1.amount5.value; var a6=document.form1.amount6.value; var a7=document.form1.amount7.value; var a8=document.form1.amount8.value; var a9=document.form1.amount9.value; var a10=document.form1.amount10.value; var a11=document.form1.amount11.value; var a12=document.form1.amount12.value; var a13=document.form1.amount13.value; var a14=document.form1.amount14.value; var a15=document.form1.amount15.value; var a16=document.form1.amount16.value; var a17=document.form1.amount17.value; var a18=document.form1.amount18.value; var t=0; for(var i=1; i<=document.form1.hdnMaxLine.value;i++) { var a19=document.getElementById("amount19"+i).value; console.log("amount19"+i); if(a1.length >0 || a2.length > 0 || a3.length > 0 || a4.length > 0 || a5.length > 0 || a6.length > 0 || a7.length > 0 || a8.length > 0 || a9.length > 0 || a10.length > 0 || a11.length > 0 || a12.length > 0 || a13.length > 0 || a14.length > 0 || a15.length > 0 || a16.length > 0 || a17.length > 0 || a18.length > 0 || a19.i > 1 ) { //alert(startMile); t=parseFloat(a1)+parseFloat(a2)+parseFloat(a3)+parseFloat(a4)+ parseFloat(a5)+parseFloat(a6)+parseFloat(a7)+parseFloat(a8)+ parseFloat(a9)+parseFloat(a10)+ parseFloat(a11)+parseFloat(a12)+parseFloat(a13)+parseFloat(a14)+parseFloat(a15)+parseFloat(a16)+parseFloat(a17)+ parseFloat(a18)+parseFloat(document.getElementById("amount19"+i).value); } document.form1.total.value=t; } }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง