为什么添加行这个函数没有用,哪错了
function addtr(){
var oldnode=document.getElementById("table").lastChild;
var newtr=createElement("tr");
var newtdsn=createElement("td");
var sn=prompt("输入学号","h001");
newtdsn.innerHTML=sn;
var newtdname=createElement("td");
var name=prompt("输入姓名","王小明");
newtdname.innerHTML=name;
var newtdoperation=createElement("td");
var newhref=createElement("a");
a.setAttribute("href","javascript:");
a.setAttribute("onclick","deletetr(this)");
a.innerHTML="删除";
oldnode.appendChild(newtr);
newtr.appendChild(newtdsn);
newtr.appendChild(newtdname);
newtr.appendChild(newtdoperation);
newtdoperation.appendChild(newa);
}