Advertisement
AaronSawyer

eval-based Javascript test page

Feb 6th, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.71 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html lang="en-us"><!--<![endif]--><head>
  3.   <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  4.   <meta charset="utf-8">
  5.   <head>
  6.     <script type="text/javascript">//<![CDATA[
  7. "use strict";
  8. var x   = 0,
  9.    $   = function(x){return document.getElementById(x);},
  10.    bw  = function(id,val){
  11.            var thid = id, thval= val;
  12.            $(thid).value = thval;
  13.            $(thid).style.display = $(thid).style.display = 'block';
  14.          },
  15.    go  = function(idin,idout){
  16.            var res = eval($(idin).value);
  17.            bw(idout, res);
  18.          };
  19.  
  20.    //]]></script>
  21.     <style type="text/css">
  22.       h3            { margin-top:0; margin-bottom:0; margin-left:10; margin-right:10 }
  23.       input         { font-family:"Segoe UI"; font-weight:bold; font-size:10 }
  24.       textarea      { font-family:"Consolas"; font-weight:bold; width:80em; height:30em; color:#808010 }
  25.       #inputtitle1  { display:block }
  26.       #input1       { color:#408020 }
  27.       #outputtitle1 { display:block }
  28.       #output1      { color:#804020 }
  29.       #button1      { margin-left:80; color:#408010 }
  30.       #button2      { margin-left:20; color:#804010 }
  31.     </style>
  32.   </head>
  33.   <body bgcolor="#F8F8F0">
  34.       <h3 id="inputtitle1">Input</h3>
  35.       <textarea id="input1" name="input1"></textarea>
  36.       <br/>
  37.         <input id="button1" type="submit" value="Eval Input"   onclick="go('input1','output1');return false;" />
  38.         <input id="button2" type="submit" value="Clear Output" onclick="bw('output1','');return false;"       />
  39.       <h3 id="outputtitle1">Output</h3>
  40.       <textarea id="output1" name="output1"></textarea>
  41.   </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement