Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/08/2004, 09:34
Avatar de tunait
tunait
Moderadora
 
Fecha de Ingreso: agosto-2001
Ubicación: Terok Nor
Mensajes: 16.805
Antigüedad: 23 años, 6 meses
Puntos: 381
A las buenas y santas....

Bueno, lo primero, decir que me parece una cosa absurda el hacer algo así.

Lo segundo.... lo que me he divertido haciendo algo tán absurdo! jeje....

Prueba a ver si este ejemplo te sirve

Código:
<?xml version="1.0" encoding="iso-8859-1"?>
<!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>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" type="text/javascript">
var opc = new Array('pepe','juan','perico')
function cambia(valor){
obj = document.createElement('select')
obj.id = 'pepe'
obj.onchange = function(){
	cambia2(this.value)
	}
obj.onblur = function(){
	cambia2(this.value)
	}
for(m=0; m<opc.length;m++){
	opt = document.createElement('option')
	opt.value = opc[m]
	opt.appendChild(document.createTextNode(opc[m]))
	if(valor == opc[m]){
		opt.selected = 'selected'
		}
	obj.appendChild(opt)
	}
document.body.replaceChild(obj,document.getElementById('pepe'))

}
function cambia2(valor){
obj = document.createElement('input')
obj.type = 'text'
obj.id = 'pepe'
obj.value = valor
obj.onclick = function(){
	cambia(this.value)
	}
document.body.replaceChild(obj,document.getElementById('pepe'))
}
</script>
</head>

<body>
<input name="pepe" type="text" id="pepe" onclick="cambia('')" />
</body>
</html>
A ver qué te parece