Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/07/2011, 23:46
Avatar de dvbeaumont
dvbeaumont
 
Fecha de Ingreso: marzo-2011
Ubicación: Caracas
Mensajes: 145
Antigüedad: 13 años, 1 mes
Puntos: 1
Pregunta Como implemento este script dentro de otro?

tengo este script:

Código Javascript:
Ver original
  1. <table style="height: 100%; width: 100%;" cellspacing="0" cellpadding="0">
  2.       <tr style="height: 100%;">
  3.         <td style="vertical-align: top; text-align: left;">
  4.           <input type="text" id="cal-field-1" />
  5.           <button type="submit" id="cal-button-1">...</button>
  6.           <script type="text/javascript">
  7.             Calendar.setup({
  8.               inputField    : "cal-field-1",
  9.               button        : "cal-button-1",
  10.               align         : "Tr"
  11.             });
  12.           </script>
  13.         </td>
  14.         <td style="vertical-align: bottom; text-align: right;">
  15.           <input type="text" id="cal-field-2" />
  16.           <button type="submit" id="cal-button-2">...</button>
  17.           <script type="text/javascript">
  18.             Calendar.setup({
  19.               inputField    : "cal-field-2",
  20.               button        : "cal-button-2"
  21.             });
  22.           </script>
  23.         </td>
  24.       </tr>
  25.     </table>

y quiero que cumpla funciones de este:

Código Javascript:
Ver original
  1. <div style="float: right; margin-left: 1em; margin-bottom: 1em;"
  2. id="calendar-container"></div>
  3.  
  4. <script type="text/javascript">
  5.   function dateChanged(calendar) {
  6.     // Beware that this function is called even if the end-user only
  7.     // changed the month/year.  In order to determine if a date was
  8.     // clicked you can use the dateClicked property of the calendar:
  9.     if (calendar.dateClicked) {
  10.       // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
  11.       var y = calendar.date.getFullYear();
  12.       var m = calendar.date.getMonth();     // integer, 0..11
  13.       var d = calendar.date.getDate();      // integer, 1..31
  14.       // redirect...
  15.       window.location = "/calendario-mlb.php?id_calen="+ y +"-"+ m +"-"+ d +"";
  16.     }
  17.   };
  18.  
  19.   Calendar.setup(
  20.     {
  21.       flat         : "calendar-container", // ID of the parent element
  22.       flatCallback : dateChanged           // our callback function
  23.     }
  24.   );
  25. </script>

Que sucede, el primer codigo son dos input que despliegan un calendario! y el segundo es uno que al darle click a una fecha te lleva directamente a ella... quiero que despliegue el calendario y luego que al darle click a una fecha me lleve a ella...

Esos dos codigos debo implementarlos pero desconozco la manera correcta.

AYUDA POR FAVOR.