Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.89 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. if possible that run a php tag in javascript?
  2. <script type="text/javascript">
  3.            function mehdi()
  4.            {
  5.                alert('salam');
  6.               <?php
  7.                echo'hi';
  8.                ?>
  9.  
  10.              }
  11.  
  12. </script>
  13. this is html:
  14.       <input type="button" name ="submit" value="submit" onclick= "mehdi()">
  15.        
  16. <script type="text/javascript">
  17. function mehdi()
  18.        {
  19.           alert('salam');
  20.           hi
  21.         }
  22. </script>
  23.        
  24. <script type="text/javascript">
  25.            function mehdi()
  26.            {
  27.                alert('<?php echo "hi";?>');
  28.             }
  29.  
  30. </script>
  31.        
  32. <script type="text/javascript">
  33.            function mehdi()
  34.            {
  35.                alert("<?='hi';?>");
  36.             }
  37.  
  38. </script>
  39.        
  40. <?php
  41. $pageTitle = 'Mypage';
  42. ?>
  43.  
  44. <script type="text/javascript">
  45.        function mehdi()
  46.        {
  47.            alert('<?php echo $pageTitle ;?>');
  48.         }
  49.  
  50. </script>