Foros del Web » Programando para Internet » Javascript »

Habilitar un text

Estas en el tema de Habilitar un text en el foro de Javascript en Foros del Web. Hola amigos, tengo un problema para los que conocen de php: Tengo que habilitar un text al pinchar un radio button. miren este es el ...
  #1 (permalink)  
Antiguo 08/02/2005, 10:48
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago de Chile
Mensajes: 504
Antigüedad: 19 años, 6 meses
Puntos: 0
Habilitar un text

Hola amigos, tengo un problema para los que conocen de php:
Tengo que habilitar un text al pinchar un radio button. miren este es el codigo:

$n=1;
while ($row=mysql_fetch_array($consultar))
{
$ot = "$row[0]";
$total="$row[1]";
?>
<!--Aqui desplegar os resultados-->
<tr>
<td><input name="algo" type="radio" value="acepto" checked></td>
<td><input name="algo" type="radio" value="rechazo" onClick="rechazar('<?php echo "obj".$n; ?>')"></td>
<td><?php echo $ot; ?></td>
<td><?php echo $total; ?></td>
<td><?php echo $fecha_bien; ?></td>
<td><input type="text" name="<?php echo 'obj'.$n; ?>" disabled ></td>
</tr>

<?php
$n++;


y esta la funcion js:
function rechazar(ott)
{
//getElementById: indica un dato de un objeto ej: el nombre
//foto = document.getElementById("foto");
var nombre;
with (document)
{
nombre = getElementById(ott).name;
//window.document.write(nombre);
//window.document.write(ott);
rendir_dms.nombre.disabled=false;
rendir_dms.nombre.focus();
}
}



Supongo que aqui, en js esta el problema.

Gracia
Atte
Maurimono

Última edición por maurimono; 08/02/2005 a las 12:11
  #2 (permalink)  
Antiguo 08/02/2005, 14:17
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago de Chile
Mensajes: 504
Antigüedad: 19 años, 6 meses
Puntos: 0
Sonrisa

lo anteruior funciona bien de la siguiente forma: (al ejecutarlo como html sin tomar en cuenta el php)

$n=1;
while ($row=mysql_fetch_array($consultar))
{
$ot = "$row[0]";
$total="$row[1]";
?>
<!--Aqui desplegar os resultados-->
<tr>
<td><input name="algo" type="radio" value="acepto" checked></td>
<td><input name="algo" type="radio" value="rechazo" onClick="rechazar('<?php echo "obj".$n; ?>')"></td>
<td><?php echo $ot; ?></td>
<td><?php echo $total; ?></td>
<td><?php echo $fecha_bien; ?></td>

<!--ojo aqui -->
<td><input type="text" name="texto" disabled ></td>
</tr>

<?php
$n++;

el js:

function rechazar()
{
with (document.rendir_dms)
{
texto.disabled=false;
texto.focus();
}
}

  #3 (permalink)  
Antiguo 08/02/2005, 15:52
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago de Chile
Mensajes: 504
Antigüedad: 19 años, 6 meses
Puntos: 0
mas facil:

estoy dentro de un while, este debolvera tantos

<tr>
<td><input name="algo" type="radio" value="acepto" checked></td>
<td><input name="algo" type="radio" value="rechazo" onClick="rechazar('<?php echo "obj".$n; ?>')"></td>
<td><?php echo $ot; ?></td>
<td><?php echo $total; ?></td>
<td><?php echo $fecha_bien; ?></td>

<!--ojo aqui -->
<td><input type="text" name="texto" disabled ></td>
</tr>

como registros encuentre.
entonces como hago referencia a un text en particular para habilitarlo?

A ver si alguien es capo!
Atte
Maurimono
  #4 (permalink)  
Antiguo 09/02/2005, 06:31
 
Fecha de Ingreso: octubre-2004
Ubicación: Santiago de Chile
Mensajes: 504
Antigüedad: 19 años, 6 meses
Puntos: 0
Bueno, el prolema estaba en dos parte:

1)en html agregar un Id. que perita identificarlo

<input type="text" name="<?php echo 'txt'.$n ?>" disabled id="<?php echo 'txt'.$n ?>">

2)en la funcion Js. Faltaba:
function rechazar(ott)
{
//alert ("entro");
with (document)
{
//alert ("entro ");
getElementById(ott).disabled=false;
getElementById(ott).focus();
}
}

Todo esto gracias a la gentil ayuda de NOSTROMO

Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:23.