Link to home
Create AccountLog in
Avatar of KeithMcElroy
KeithMcElroy

asked on

set name attribute failing

The attached code in a web page is not updating the name attribute.
The old name appears in the alert of outerHTML.
I tried removeAttribute then reassigning and NO name attribute shows.

What am i missing?
function addsplititem(id,idx,tbod,tab)
{

	var tab = GetElement("tblsplit_" + idx)

	var tbod = tab.tBodies[1]

	
	var trow = tbod.rows[tbod.rows.length - 1]

	var clonerow = trow.cloneNode(true);	
	var newtrow= tbod.appendChild(clonerow)
	
	newtrow.setAttribute("subidx", Number(newtrow.getAttribute("subidx")) + 1)
	var tds = newtrow.childNodes 
	for(t=0;t<tds.length;t++)
	{
		var sds = tds[t].childNodes
		for(s=0;s<sds.length;s++)
		{
			if(sds[s].nodeName == "INPUT")
			{
				if(sds[s].getAttribute("autoinc") == "b")
				{

					var arrpieces = sds[s].id.split("_")
					var loc0 = arrpieces[0]
					var loc1 = arrpieces[1]
					var loc2 = arrpieces[2]
					var loc3 = arrpieces[3]
					var loc4 = (Number(arrpieces[4]) + 1).toString()
					locid = loc0 + "_" + loc1 + "_" + loc2 + "_" + loc3 + "_" + loc4
					sds[s].id = locid
					sds[s].removeAttribute("name")
					sds[s].setAttribute("name",  locid)
				alert(sds[s].outerHTML)
				}
			}
		}
		
	}
	//alert(newtrow.outerHTML)
	
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of vr6r
vr6r

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of KeithMcElroy
KeithMcElroy

ASKER

yes, IE.  Need a work around.
Any hope of that?