Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/04/2011, 10:44
alfa18
 
Fecha de Ingreso: diciembre-2007
Mensajes: 299
Antigüedad: 16 años, 5 meses
Puntos: 2
Pregunta paso de parametros a una funcion JS

<script type="text/javascript">
function f1(x,txt,val){
............
...........
.......
}

</script>
<BODY bgcolor="orange">
<FORM name="form" id="form">
Nuevo elemento:<BR>Texto<INPUT type="text" name="txt1"><BR>Valor<INPUT type="text" name="txt2"><BR>
<INPUT type="button" value="Añadir al select" onclick="..................."><BR>
</FORM>
</BODY>


f1(form,form.txt1,form.txt2) esta es la forma correcta(o al menos asi me funciona) de llamar a la funcion f1(), pero ¿por que no me funciona esta otra forma:f1(this,this.txt1,this.txt2) ?

En este ejemplo, se supone que el objeto this representa al formulario,¿no?