**I've tried (but its not working):**

```
<?php  
  $htmlString= 'testing';
?>
<html>
  <body>
    <script type="text/javascript">  
      var htmlString=<?php echo $htmlString; ?>;
      alert(htmlString);
    </script>
  </body>
</html>

```

Here is the [tutorial](http://web-design.lovetoknow.com/Define_PHP_Variables_Inside_Javascript) that I've used for that purpose: