Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/02/2014, 14:16
canorioss
 
Fecha de Ingreso: febrero-2014
Mensajes: 3
Antigüedad: 10 años, 2 meses
Puntos: 0
Respuesta: llamar a funcion javascript desde php

Código PHP:
Ver original
  1. <html>
  2. <head>
  3. <script language="javascript" >
  4. function funcion_javascript(valor)
  5.     {
  6.        alert (valor);
  7.     }
  8. </script>
  9.  
  10. </head>
  11. <body>
  12.         <?php
  13. $variable = "2";
  14. if (strcmp($variable,'2')==0)
  15.     { echo 'son las variables iguales';
  16.  
  17.         ?>
  18.         <script language="javascript">
  19.              
  20.                 funcion_javascript(<?php echo $variable;?>);
  21.         </script>
  22.  
  23.         <?php
  24.     }
  25. else {echo "No son iguales!";}
  26.         ?>
  27. </body>
  28. </html>

Aquí un poco mas completo...