新しいテーブルを作成します
3021 ワード
//
function createTable()
{
var oTable=document.getElementById("myTable");
var oTBody=document.getElementById("tbody");
var row=oTBody.rows.length;
var oTR=oTBody.insertRow(row);
var oProInf=oTBody.rows[row].insertCell(0);
var oPro=document.createElement("input");
oPro.setAttribute("type","text");
oPro.setAttribute("className","box box2");
//
oPro.attachEvent("onkeydown",sendRequest);
var oBtn=document.createElement("input");
oBtn.setAttribute("type","button");
oBtn.setAttribute("className","Mybutton8");
//oBtn.setAttribute("id","btn"+maxid);
oBtn.attachEvent("onclick",showDlg);
oProInf.appendChild(oPro);
oProInf.appendChild(oBtn);
var oName=oTBody.rows[row].insertCell(1);
//oName.setAttribute("id","proname"+maxid);
oName.appendChild(document.createTextNode(" "));
var oUnit=oTBody.rows[row].insertCell(2);
//oUnit.setAttribute("id","unit"+maxid);
oUnit.appendChild(document.createTextNode(" "));
var oQty=oTBody.rows[row].insertCell(3);
var qty=document.createElement("input");
//qty.setAttribute("id","qty"+maxid);
qty.setAttribute("type","text");
qty.setAttribute("className","box box2");
qty.attachEvent("onkeydown",computeMoney);
qty.attachEvent("onkeydown",createNewRow);
qty.attachEvent("onkeydown",moveCursor);
qty.attachEvent("onkeykdown",computeTotal2);
qty.attachEvent("onblur",computeTotal);
qty.style.visibility="hidden";
oQty.appendChild(qty);
var oPrice=oTBody.rows[row].insertCell(4);
oPrice.appendChild(document.createTextNode(" "));
var oTax=oTBody.rows[row].insertCell(5);
oTax.appendChild(document.createTextNode(" "));
var oMoney=oTBody.rows[row].insertCell(6);
oMoney.appendChild(document.createTextNode(" "));
var oDel=oTBody.rows[row].insertCell(7);
var btnDel=document.createElement("input");
btnDel.setAttribute("type","button");
btnDel.setAttribute("className","Mybutton1");
btnDel.setAttribute("value"," ");
// ,
btnDel.attachEvent("onclick",delRow);
oDel.appendChild(btnDel);
}