Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/04/2011, 11:04
Avatar de Markgus
Markgus
 
Fecha de Ingreso: junio-2010
Mensajes: 152
Antigüedad: 13 años, 10 meses
Puntos: 5
funcion javascript en funcion php

tengo un enlace a un formulario de una funcion en xajax el formulario tiene varios input y en uno de ellos necesito usar un calendario web en javscript http://sourceforge.net/projects/jscalendar/ pero al usarlo yo en la funcion del php no se no me funciona el javascript

funciones.php
Código PHP:
<?php
function agrega_ventana(){
   
   
$respuesta = new xajaxResponse('ISO-8859-1');
 
$salida  '<html> 
    <body>
     <head> 
  
<script type="text/javascript" src="calendario/calendar.js"></script>
<script type="text/javascript" src="calendario/calendar-es.js"></script>
 <script type="text/javascript" src="calendario/calendar-setup.js"></script>

</head> 
  <form id="agrega_ventana"  onSubmit="Disabled=true" >
    <table>
        
<tr>
<td> 
<input type="text" name="date" id="f_date_b" /><button type="reset" id="f_trigger_b">...</button>
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "f_date_b",      // id of the input field
        ifFormat       :    "%m/%d/%Y %I:%M %p",       // format of the input field
        showsTime      :    true,            // will display a time selector
        button         :    "f_trigger_b",   // trigger for the calendar (button ID)
        singleClick    :    false,           // double-click mode
        step           :    1                // show all years in drop-down boxes (instead of every other year as default)
    });
</script>
</td>
</tr>
  <tr>
    <td >
        <input type="button" value="Agregar" onClick="xajax_procesar_agregar(xajax.getFormValues(\'agrega_ventana\'))">
            </td>
        </tr>
</table>
                       </form>
          </body>        
</html>'

 

   
$respuesta->addAssign("contenido","innerHTML","$salida");
   return 
$respuesta;
   
}
?>
pero si hago la prueba con un echo en otro php si me agarra bien el javascript
prueba.php
Código PHP:
<?php

echo '<html>
       <head>
        
    <script type="text/javascript" src="calendario/calendar.js"></script>
<script type="text/javascript" src="calendario/calendar-es.js"></script>
 <script type="text/javascript" src="calendario/calendar-setup.js"></script>
</head>
<body>
<input type="text" name="date" id="f_date_b" /><button type="reset" id="f_trigger_b">...</button>
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "f_date_b",      // id of the input field
        ifFormat       :    "%m/%d/%Y %I:%M %p",       // format of the input field
        showsTime      :    true,            // will display a time selector
        button         :    "f_trigger_b",   // trigger for the calendar (button ID)
        singleClick    :    false,           // double-click mode
        step           :    1                // show all years in drop-down boxes (instead of every other year as default)
    });
</script>
  

</body>
</html>
'
;

?>
pues el enlace a <a onclick="xajax_agrega_ventana()"></a> si me funciona bien si me carga todo el form el único problema es ese que no me funciona el javascript alguna sugerencia? o no se puede usar asi?

PD resumí el código a la parte del problema solamente si se necesita que muestre algo mas de código me dicen