Advertisement
svetoslavbozov

[JS] Operators and Expressions 8

Mar 13th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title></title>
  4. <link href="styles/js-console.css" rel="stylesheet" />
  5. </head>
  6. <body>
  7.     <div id="js-console">
  8.         <div>
  9.             <label>Side A: </label>
  10.             <input type="text" id="aSide"/>                
  11.         </div>
  12.         <div>
  13.             <label>Side B: </label>
  14.             <input type="text" id="bSide"/>                
  15.         </div>
  16.         <div>
  17.             <label>Height: </label>
  18.             <input type="text" id="height"/>                
  19.         </div>
  20.         <div>
  21.             <label>Calculate area : </label>
  22.             <input type="button" Value="Calc" onclick="CalculateArea()"/>
  23.         </div>
  24.     </div>
  25.     <script src="scripts/js-console.js">   
  26.     </script>  
  27.     <script>
  28.         function CalculateArea() {
  29.         var a = jsConsole.readFloat("#aSide");
  30.         var b = jsConsole.readFloat("#bSide");            
  31.         var height = jsConsole.readFloat("#height");
  32.  
  33.         jsConsole.writeLine((a + b) * height / 2);
  34.         }  
  35. </script>  
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement