Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/11/2010, 05:29
cdposada
 
Fecha de Ingreso: mayo-2006
Mensajes: 26
Antigüedad: 18 años
Puntos: 0
Dificultad al Asignar un valor a un input

Saludos !!!!

Tengo el siguiente código HTML. La idea es que, al dar clic en el enlace, el id de la etiqueta <a> aparezca en la caja de texto. Le problema es que lo hace pero inmediatamente se desaparece. ¿Cómo pude hacer para que el valor se conserve?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript1.5">
function llenarTextbox(valor){
document.getElementById("textfield").value = valor;
}
</script>
</head>


<body>
<form id="form1" name="form1" method="post" action="">
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><label>
<input type="text" name="textfield" id="textfield"/>
</label></td>
</tr>
<tr>
<td><a id="abc" href="" onfocus="llenarTextbox(id)">abc</a></td>
</tr>
</table>
</form>
</body>
</html>