Foros del Web » Programando para Internet » Javascript »

texarea expandible

Estas en el tema de texarea expandible en el foro de Javascript en Foros del Web. he buscado pero los codigos que he visto no me funcionan :/ la idea es hacer un textarea expandible al igual como lo hace el ...
  #1 (permalink)  
Antiguo 27/05/2008, 19:42
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
texarea expandible

he buscado pero los codigos que he visto no me funcionan :/ la idea es hacer un textarea expandible al igual como lo hace el de aqui... con unos botoncitos imagenes arriba abajo poder manejar el largo del textarea y que al igual que aqui si apreto mucho el hacerlo pequeño llegue hasta donde esta por defecto.....

espero se entienda mi idea....
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #2 (permalink)  
Antiguo 27/05/2008, 19:56
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: texarea expandible

Fijate si te sirve:
Código PHP:
<!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>test</title>
<
script>
function $(
id){
    return 
document.getElementById(id);    
}
function 
addEvent(objevTypefnuseCapture){
 
 if (
obj.addEventListener){
    
obj.addEventListener(evTypefnuseCapture);
    
  } else if (
obj.attachEvent){
    
obj.attachEvent("on"+evTypefn);
   
  } else {
   
obj['on'+evType]=fn;
  }
}
var 
reng=5;
function 
agregar(){
    $(
'quita').disabled=false;
    
reng=reng+5;
    $(
'pp').rows=reng;
}
function 
quitar(){
    
reng=reng-5;
        if(
reng<6){reng=5;
        }
    $(
'pp').rows=reng;
}
window.onload=function(){
    
addEvent($('quita'), 'click'quitarfalse);
    
addEvent($('agrega'), 'click'agregarfalse);
}
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <textarea id="pp" name="textarea" cols="60" rows="5"></textarea>
  <input id="agrega" type="button" name="Submit" value="+" />
  <input id="quita" type="button" name="Submit2" value="-" />
</form>
</body>
</html> 
  #3 (permalink)  
Antiguo 27/05/2008, 22:01
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: texarea expandible

yes master funciona del 1 se agradece....

mi pregunta es como puedo cambiar los botones + y - por imagenes .....

:)
__________________
Gokuh Salvo al mundo. PUNTO!!!!
  #4 (permalink)  
Antiguo 27/05/2008, 22:07
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: texarea expandible

Los reemplazás por imágenes manteniendo los atributos id que tienen esos botones ;)
  #5 (permalink)  
Antiguo 27/05/2008, 22:17
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: texarea expandible

haci lo hice y nada tambien probe con href id y onclick etc... :/


Código:

<a  id="agrega" onClick="agrega" href="#deta"> <img src="mas.jpg"  id="agrega" name="Submit" title="+" width="80" height="80"/></a>&nbsp;
 <a  id="quita" onBlur="quita" href="#deta"> <img src="menos.jpg" title="-"  id="quita" name="Submit2"  width="80" height="80"/></a>


cada uno solo y todo junto asi como se vee
__________________
Gokuh Salvo al mundo. PUNTO!!!!

Última edición por kaninox; 27/05/2008 a las 22:22
  #6 (permalink)  
Antiguo 27/05/2008, 22:53
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: texarea expandible

Así funciona:
Código PHP:
<!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>test</title>
<
script>
function $(
id){
    return 
document.getElementById(id);    
}
function 
addEvent(objevTypefnuseCapture){
 
 if (
obj.addEventListener){
    
obj.addEventListener(evTypefnuseCapture);
    
  } else if (
obj.attachEvent){
    
obj.attachEvent("on"+evTypefn);
   
  } else {
   
obj['on'+evType]=fn;
  }
}
var 
reng=5;
function 
agregar(){
    $(
'quita').disabled=false;
    
reng=reng+5;
    $(
'pp').rows=reng;
}
function 
quitar(){
    
reng=reng-5;
        if(
reng<6){reng=5;
        }
    $(
'pp').rows=reng;
}
window.onload=function(){
    
addEvent($('quita'), 'click'quitarfalse);
    
addEvent($('agrega'), 'click'agregarfalse);
}
</script>
</head>

<body><img id="agrega" src="http://www.forosdelweb.com/customavatars/avatar115517_1.gif" /><img  id="quita" src="http://www.forosdelweb.com/customavatars/avatar65984_1.gif" />
<form id="form1" name="form1" method="post" action="">
  <textarea id="pp" name="textarea" cols="60" rows="5"></textarea>
</form>
</body>
</html> 
(Lo único que hice es reemplazar los botones por imágenes, manteniendo los idis que tenían los botones)
  #7 (permalink)  
Antiguo 27/05/2008, 22:55
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: texarea expandible

(si necesitás la manito, agregá a las imágenes un style="cursor:pointer;")
  #8 (permalink)  
Antiguo 28/05/2008, 22:01
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: texarea expandible

gracias man me has salvado :)
__________________
Gokuh Salvo al mundo. PUNTO!!!!
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 09:27.