andrew4582

JS Math Testing

Jun 27th, 2011
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var textbox1 =  document.getElementById('textbox1');
  2.  
  3. var select1 =  document.getElementById('select1');
  4.  
  5. try
  6. {
  7. var math = {
  8.   square: function(x){
  9.      return x * x;
  10.   },
  11.   cube: function(x) {
  12.     return x * this.square(x);
  13.   }
  14. };
  15. var num = 4;
  16.  
  17. textbox1.value = 'num: ' + num;
  18. textbox1.value += ' , square: ' + math.square(num);
  19. textbox1.value += ' , cube: ' + math.cube(num);
  20. textbox1.style.width = '300px';
  21.  
  22. }catch(e){
  23.    textbox1.value = e.Message;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment