Ver Mensaje Individual
  #9 (permalink)  
Antiguo 29/10/2011, 22:47
Avatar de jor_0203
jor_0203
 
Fecha de Ingreso: octubre-2011
Ubicación: mexico
Mensajes: 760
Antigüedad: 12 años, 6 meses
Puntos: 8
Respuesta: esto es payta gente que le gusta programar en javascript un reto personal

que interesantes aportes
aunque yo encontré la forma así
nota si saben otras formas me dicen


Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Documento sin t&iacute;tulo</title>
  6. <style type="text/css">
  7. <!--
  8. body {
  9. background-color: #FFCC99;
  10. }
  11. .contenedor{ width:700px; height:800px;}
  12. a{
  13.     background:#FFCC00;
  14.     border: medium solid #666666;
  15. }
  16. -->
  17. </style>
  18. <script type="text/javascript">
  19. var g, tt;
  20. var p=0,t;
  21. function mover(obj){
  22. if(p>350){
  23. clearTimeout(t);
  24. p=0;
  25. return;
  26. }
  27. p+=5;
  28. document.getElementById(obj).style.height=p+'px';
  29. document.getElementById(obj).style.width=p+'px';
  30. t=setTimeout( function(){ mover(obj) },30 ); }
  31.  
  32. function restar(obj){
  33.  g=parseInt(document.getElementById(obj).style.height);
  34.   document.getElementById("fg").innerHTML = g;
  35. if(g<=50){
  36. clearTimeout(tt);
  37. g=0;
  38. return;
  39. }
  40. g-=5;
  41. document.getElementById("fg").innerHTML =g;
  42. document.getElementById(obj).style.height=g+'px';
  43. document.getElementById(obj).style.width=g+'px';
  44. tt=setTimeout( function(){ restar(obj) },30 ); }
  45. </script>
  46. </head>
  47.     <body>
  48. <a onclick="mover('cuadros')">cuadro uno mosatar </a> &nbsp;<a onclick="restar('cuadros')">cuadros uno pregar</a>&nbsp; <a onclick="mover('cuadro')">cuadro dos</a>
  49.   &nbsp;<a onclick="restar('cuadro')">cuadro dos pregar</a>
  50.   <div class="contenedor" >    
  51. <div id="cuadros" style="width:355px; height:355px; background-color:#F00; position:absolute; text-align:center; line-height:50px; color:white; top: 36px; left: 12px;" onClick="mover('cuadros')">click</div>
  52.     <br />
  53.     <br />
  54.     <br />
  55. <div id="cuadro" style="width:355px; height:355px; background-color:#F00; position:absolute; text-align:center; line-height:50px; color:white; left: 367px; top: 36px;" >click</div>
  56.  </div>
  57.  <div id="fg"></div>  
  58.    
  59.     </body>
  60.     </html>