Ver Mensaje Individual
  #8 (permalink)  
Antiguo 29/10/2007, 13:00
gsuarez24
 
Fecha de Ingreso: octubre-2007
Mensajes: 1
Antigüedad: 16 años, 6 meses
Puntos: 0
Re: insertar filas con valor "autonumerico"

Cita:
Iniciado por choroy Ver Mensaje
SOLUCIONADO tambien, no sabia que habia que ponerle los {} a la condicion
Disculpenme, soy nuevo en esto y quiero saber como valido estas filas... aca les mando mi codigo:
lo he intentado con un hidden:

<input type='hidden' name='val' value='0'>

este es para agregar.

function addAgenda(){
if (!document.createElement) return false;
if (!document.createTextNode) return false;
if (!document.getElementById) return false;
if (!document.getElementById('agenda')) return false;



// get table and image
var tb = document.getElementById('agenda');
tb.name='tabl';
tb.border='0px';
tb.cellPadding='0px';

rowNum = parseInt(tb.rows.length);
k=rowNum;

if(document .forms[0].val.value=='0'){
val=0;
val=val+k;
alert(val);}

// for each attribute, add table row
var rw = tb.insertRow(-1);

// create tree table cells
var celd1 = rw.insertCell(0);
var celd2 = rw.insertCell(1);

celd1.width = '50%';
celd2.width = '50%';

celd1.bgcolor='#000000';
celd2.bgcolor='#000000';

// create elements
var tem = document.createElement('input');
tem.setAttribute('width','34px');


tem.type='text';
tem.size='3';
tem.className='inpCod';
tem.id='sTem['+k+']';
tem.name='sTem['+k+']';
var dur = document.createElement('input');

dur.type='text';
dur.className='inpTex';
dur.name='sDur['+k+']';



// append elements to cells
celd1.appendChild(tem);
celd2.appendChild(dur);

}

</script>



este para validar:

function validar(){


if(document .forms[0].val.value=='0'){

alert(val);}
//document.forms[0].submit();
}