Retroceder   Foros del Web > Programación para sitios web > Javascript

Respuesta
 
Herramientas Desplegado
Antiguo 27-may-2008, 20:42   #1 (permalink)
kaninox tiene algunos puntos positivos de karma
 
Avatar de kaninox
 
Fecha de Ingreso: septiembre-2005
Ubicación: Chile
Mensajes: 2.376
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....
__________________
Debo admitir que he pecado, uso mas el windows que el linux :'( perdóname....
kaninox está desconectado   Responder Citando
Antiguo 27-may-2008, 20:56   #2 (permalink)
Colaborador
Panino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradable
 
Avatar de Panino5001
 
Fecha de Ingreso: mayo-2004
Ubicación: Buenos Aires
Mensajes: 1.984
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> 
Panino5001 esta en línea ahora   Responder Citando
Antiguo 27-may-2008, 23:01   #3 (permalink)
kaninox tiene algunos puntos positivos de karma
 
Avatar de kaninox
 
Fecha de Ingreso: septiembre-2005
Ubicación: Chile
Mensajes: 2.376
Respuesta: texarea expandible

yes master funciona del 1 se agradece....

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

:)
__________________
Debo admitir que he pecado, uso mas el windows que el linux :'( perdóname....
kaninox está desconectado   Responder Citando
Antiguo 27-may-2008, 23:07   #4 (permalink)
Colaborador
Panino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradable
 
Avatar de Panino5001
 
Fecha de Ingreso: mayo-2004
Ubicación: Buenos Aires
Mensajes: 1.984
Respuesta: texarea expandible

Los reemplazás por imágenes manteniendo los atributos id que tienen esos botones ;)
Panino5001 esta en línea ahora   Responder Citando
Antiguo 27-may-2008, 23:17   #5 (permalink)
kaninox tiene algunos puntos positivos de karma
 
Avatar de kaninox
 
Fecha de Ingreso: septiembre-2005
Ubicación: Chile
Mensajes: 2.376
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
__________________
Debo admitir que he pecado, uso mas el windows que el linux :'( perdóname....

Última edición por kaninox; 27-may-2008 a las 23:22.
kaninox está desconectado   Responder Citando
Antiguo 27-may-2008, 23:53   #6 (permalink)
Colaborador
Panino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradable
 
Avatar de Panino5001
 
Fecha de Ingreso: mayo-2004
Ubicación: Buenos Aires
Mensajes: 1.984
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)
Panino5001 esta en línea ahora   Responder Citando
Antiguo 27-may-2008, 23:55   #7 (permalink)
Colaborador
Panino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradablePanino5001 es realmente agradable
 
Avatar de Panino5001
 
Fecha de Ingreso: mayo-2004
Ubicación: Buenos Aires
Mensajes: 1.984
Respuesta: texarea expandible

(si necesitás la manito, agregá a las imágenes un style="cursor:pointer;")
Panino5001 esta en línea ahora   Responder Citando
Antiguo 28-may-2008, 23:01   #8 (permalink)
kaninox tiene algunos puntos positivos de karma
 
Avatar de kaninox
 
Fecha de Ingreso: septiembre-2005
Ubicación: Chile
Mensajes: 2.376
Respuesta: texarea expandible

gracias man me has salvado :)
__________________
Debo admitir que he pecado, uso mas el windows que el linux :'( perdóname....
kaninox está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 10:16.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96