前台技术--多行录入域实现

function insert(){
	var aalen = document.getElementsByName("aa").length;
	aalen = eval(3+aalen);
	
	var x=document.getElementById('adInfo').insertRow(aalen);
	var y=x.insertCell(0);
	y.style.width="270px";
	y.style.height="18px";
	y.colSpan = "4";
	
	var text = "<td>";
	text += "<font>监测类型:</font>";
	text += "<input type=\"text\" name= \"aa\" />";
	text += "<font>监测URL:</font>";
	text += "<input type=\"text\" name= \"bb\" style=\"width:500px\" />";
	text += "<input type=\"button\" name=\"delListener\" onclick=\"del(this)\">";
	text += "</td>";
	
	y.innerHTML=text;
}

function del(obj){
    var index=obj.parentNode.parentNode.rowIndex;
    var table = document.getElementById("adInfo");
    table.deleteRow(index);
}


你可能感兴趣的:(前台技术--多行录入域实现)