Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/03/2005, 09:43
Avatar de chalchis
chalchis
 
Fecha de Ingreso: julio-2003
Mensajes: 1.773
Antigüedad: 20 años, 10 meses
Puntos: 21
Pregunta Insertar fila y un input text, pero no me accepta un class

<script language="javascript">

function AddRowsToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);

var cellRight = row.insertCell(0);
var el = document.createElement('input');
el.setAttribute('type', 'text');
el.setAttribute('name', 'answers[]' + iteration);
el.setAttribute('size', '30');
cellRight.setAttribute('id',iteration)
cellRight.appendChild(el);
// var aa = document.createElement("<a href='#' onClick='RemoveRowFromTable();return false;'>Remove Last</a>'");
var aa = document.createElement("a");
aa.setAttribute('href', '#');
var clickName = new Function("DeleteRow(this)");
aa.onclick = clickName;
aa.innerHTML = "<img src=delete.gif border=0>";
cellRight.appendChild(aa);
}
function DeleteRow(x)
{
while (x.tagName.toLowerCase() !='tr')
{
if(x.parentElement)
x=x.parentElement;
else if(x.parentNode)
x=x.parentNode;
else
return;
}
var rowNum=x.rowIndex;
while (x.tagName.toLowerCase() !='table')
{
if(x.parentElement)
x=x.parentElement;
else if(x.parentNode)
x=x.parentNode;
else
return;
}
x.deleteRow(rowNum);
}

function RemoveRowFromTable(rowid) {
//alert("sadfs");
var tbl = document.getElementById(iteration);
//var lastRow = tbl.rows.length;
//if (lastRow > 1)
tbl.deleteRow(rowid);
}
</script>

//aqui tengo la tabla donde se va incrementando las filas con un input text

<input name="button" type=button onClick="AddRowsToTable();return false;" value="+" class="Buttonforms">
<table cellpadding="0" cellspacing="0" width="96%" id="tblSample">

</table>


porque en los atributos de asigno un class y no hace ningun cambio
como puedo hacer eso yo le pongo asi
el.setAttribute('class, 'sombras'); y no me hace nada.

espero sus comentarios amigos
Gracias
__________________
gerardo

Última edición por chalchis; 01/03/2005 a las 09:47