Advertisement
unfalse

simplest js interpreter

Dec 12th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title>JS interpreter</title>
  4. </head>
  5. <body>
  6.     <textarea id="editor" rows="10" cols="45"></textarea>
  7.     <br/>
  8.     <input type="button" id="run" value="Run"></input>
  9.    
  10.     <div id="result">
  11.     </div>
  12.    
  13.     <script>
  14.         document.getElementById('run').onclick = function()
  15.         {
  16.             var res = document.getElementById('result');
  17.             var text = document.getElementById('editor');
  18.             res.innerHTML = eval(text.value);
  19.         }
  20. </script>
  21. </body>
  22. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement