Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <html>
  2.  
  3. <script>
  4.  
  5. function area_calc(l,w)
  6.  
  7. {
  8. document.calc.area.value = l*w;
  9. document.calc.perimeter.value = parseInt(l) + parseInt(w) + parseInt(l) + parseInt(w);
  10.  
  11.  
  12. }
  13.  
  14. </script>
  15.  
  16.  
  17. <body>
  18.  
  19.  
  20. <form name = "calc">
  21.  
  22. please enter the length and width of a room and this program will give you the Area and Perimeter
  23.  
  24. <br>
  25.  
  26.  
  27. length<input type = text name = "length" value = "" size = "7"
  28.  
  29. onchange= "area_calc(document.calc.length.value,document.calc.width.value)">
  30.  
  31. width<input type = text name= "width" value="" size ="7"
  32.  
  33. onchange="area_calc(document.calc.length.value,document.calc.width.value)">
  34.  
  35. area<input type = text name= "area" value="" size ="7">
  36.  
  37. perimeter<input type = text name= "perimeter" value="" size ="7">
  38.  
  39.  
  40.  
  41. </form>
  42.  
  43. </body>
  44.  
  45.  
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement