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

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 9  |  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. Passing PHP variable to Javascript function
  2. <?php $repname    = $_SESSION['REPNAME']; ?>
  3. <script type="text/javascript" src="js/chat.js"></script>
  4.  
  5. <input type="button" name="btn_send_chat" id="btn_send_chat" value="Send" onclick="javascript:sendChatText('<?php echo $repname;?>');" />
  6.        
  7. function sendChatText(repname) {
  8.     alert(repname);
  9.  
  10.         }
  11.        
  12. var repName;
  13.         function sendChatText() {
  14.         repName = '<?php echo $repname;?>';
  15.                     }