Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/11/2010, 15:03
jorodriguea
 
Fecha de Ingreso: noviembre-2010
Mensajes: 67
Antigüedad: 14 años, 2 meses
Puntos: 0
Respuesta: Usar javascript en codigo generado con php

Gracias por tu respuesta. Aquí esta mi código

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.         <link rel="stylesheet" type="text/css" media="all" href="../Javascript/JSCal/skins/tiger/theme.css"/>
  6.         <script type="text/javascript" src="../Javascript/JSCal/calendar.js"></script>
  7.         <script type="text/javascript" src="../Javascript/JSCal/lang/calendar-es.js"></script>
  8.         <script type="text/javascript" src="../Javascript/JSCal/calendar-setup.js"></script>
  9.  
  10.         <title>Listado de Bimestres</title>
  11.     </head>
  12.  
  13.     <body>
  14.         <div>
  15.  
  16.             <h2>Listado Bimestres </h2>
  17.             <form id="bimestre" name="bimestre" method="post" action="pruebaindex2.php?controlador=Bimestre&accion=modificarBimestre">
  18.                 <fieldset>
  19.                     <legend>Modificar Bimestre</legend>
  20.                     <?php
  21.                     // $resultado es una variable asignada desde el controlador ControladorBimestre.
  22.  
  23.                     $identificador;
  24.                     $alias;
  25.                     $fechainicio;
  26.                     $fechatermino;
  27.                     $comentario;
  28.  
  29.                     foreach ($resultado as $object) {
  30.  
  31.                         $identificador = $object->getIdentificador();
  32.                         $alias = $object->getAlias();
  33.                         $fechainicio = $object->getFechaInicio();
  34.                         $fechatermino = $object->getFechaTermino();
  35.                         $comentario = $object->getComentario();
  36.                     }
  37.  
  38.         echo "<table width='437' border='0' align='left'>
  39.            <tr>
  40.                <th width='112' align='left' scope='row'><label for='bimestre_identificador'>Identificador:</label></th>
  41.                <td width='315'><input type='text' id='bimestre_identificador' name='bimestre_identificador' maxlength='30' value='" . $identificador . "' readonly='readonly'></td>
  42.            </tr>
  43.            <tr>
  44.                <th scope='row' align='left'><label for='bimestre_alias'>Alias:</label></th>
  45.                <td><input type='text' id='bimestre_alias' name='bimestre_alias' maxlength='30' value='" . $alias . "'></td>
  46.            </tr>
  47.            <tr>
  48.                <th scope='row' align='left'><label for='bimestre_fecha_inicio'>Fecha Inicio:</label></th>
  49.                <td> <input type='text' id='bimestre_fecha_inicio' name='bimestre_fecha_inicio'value='" . $fechainicio . "' readonly='readonly'/>
  50.                <img src='/reservas/CSS/Img/calendar.png' id='trigger'/></td>
  51.            </tr>
  52.            <tr>
  53.                <th scope='row' align='left'><label for='bimestre_fecha_termino'>Fecha Termino:</label></th>
  54.                <td><input type='text' id='bimestre_fecha_termino' name='bimestre_fecha_termino' value='" . $fechatermino . "' readonly='readonly'/>
  55.                <img src='/reservas/CSS/Img/calendar.png' id='trigger2'/></td>
  56.            </tr>
  57.            <tr>
  58.                <th scope='row' align='left'><label for='bimestre_comentario'>Comentario:</label></th>
  59.                <td><textarea name='bimestre_comentario' id='bimestre_comentario' cols='45' rows='5'>" .$comentario. "</textarea></td>
  60.            </tr>
  61.        </table>
  62.  
  63.            "; ?>
  64.             <script type='text/javascript'>
  65.                 Calendar.setup(
  66.                 {
  67.                     inputField  : 'bimestre_fecha_inicio',         // ID of the input field
  68.                     ifFormat:     '%Y-%m-%d', // the date format
  69.                     button      : 'trigger' ,
  70.                     weekNumbers: false,
  71.                     showsTime   : false     // ID of the button
  72.                 }
  73.             );
  74.             </script>
  75.             <script type='text/javascript'>
  76.                 Calendar.setup(
  77.                 {
  78.                     inputField  : 'bimestre_fecha_termino',         // ID of the input field
  79.                     ifFormat    : '%Y-%m-%d',    // the date format
  80.                     button      : 'trigger2',       // ID of the button
  81.                     weekNumbers: false,
  82.                     showsTime   : false
  83.                 }
  84.             );
  85.             </script>
  86.      
  87.            
  88.         </div>
  89.     </body>
  90. </html>

Basicamente estoy colocando los calendarios en bimestre_fecha_inicio y bimestre_fecha_termino y los ejecuto presionando trigger1 y trigger2.