日期:2014-05-16 浏览次数:20416 次
function addNewNode(){
var formObj=document.getElementById("form1");
//form-add
var Obj=document.createElement("input");
Obj.value="";
formObj.appendChild(Obj);
var aObj=document.createElement("a");
aObj.href="";
aObj.innerHTML="click";
formObj.appendChild(aObj);
var btnObj=document.createElement("input");
btnObj.type="button";
btnObj.value="-";
btnObj.onclick=function(){
//删除新增的记录
};
formObj.insertBefore(btnObj,formObj.firstChild);
}
var Rand; //产生个随机编号,你自己可以根据需要自行设计,我这里偷懒就用随机数了
function addNewNode(){
Rand = Math.random();
var formObj=document.getElementById("form1");
//form-add
var Obj=document.createElement("input");
Obj.value="1";
Obj.id = "ip"+Rand; //新增input name = Rand
formObj.appendChild(Obj);
var aObj=document.createElement("a");
aObj.href="";
aObj.innerHTML="click";
aObj.value = "2"
aObj.id = "a"+Rand;//新增a name = Rand
formObj.appendChild(aObj);
var btnObj=document.createElement("input");
btnObj.type="button";
btnObj.value="-";
btnObj.id = "bt"+Rand;//新增button name = Rand
btnObj.onclick=function(){
//删除新增的记录
formObj.removeChild(document.getElementById("ip"+Rand)) //删除记录
formObj.removeChild(document.getElementById("a"+Rand)) //删除连接
formObj.removeChild(document.getElementById("bt"+Rand)) //删除按钮
};
formObj.insertBefore(btnObj,formObj.firstChild);
}
function addNewNode() {
var formObj = document.getElementById("form1");
//form-add
var div = document.createElement('div');
var Obj = document.createElement("input");
Obj.value = "";
/////formObj.appendChild(Obj);
var aObj = document.createElement("a");
aObj.href = "";
aObj.innerHTML = "click";
///// formObj.appendChild(aObj);
var btnObj = d