Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/09/2010, 13:47
Avatar de Perr0
Perr0
 
Fecha de Ingreso: mayo-2005
Ubicación: Santiago de Chile, Chile
Mensajes: 676
Antigüedad: 19 años
Puntos: 79
Respuesta: Cómo puedo cambiar de type="text" a textarea?

algo asi?
me cansé......

********************************


Código:
<!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=iso-8859-1" />
<title>Documento sin título</title>
<script>
function cuek(){
	a=document.getElementById("elquecambia")
	if(a.tagName!="TEXTAREA"){
		tipodecambio="textarea"
		e=0
	}else{
		tipodecambio="input"
		e=1
	}
	textoanterior=a.value
	
	p=a.parentNode
	p.removeChild(a)
	t=document.createElement(tipodecambio)
	t.id="elquecambia"
	t.name="elquecambia"
	t.value=textoanterior
	if(e) t.type="text"
	document.getElementById('lb').appendChild(t)
}

</script>
</head>

<body>
<label id="lb">
  <input type="text" name="elquecambia" id="elquecambia" />
</label>
<input type="button" name="button" id="button" value="Bot&oacute;n" onclick="cuek()" />
</body>
</html>