Advertisement
Guest User

calling two functions in javascript

a guest
Jul 24th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var userInput = 10; //Get user input. I don't know how it's done in c.
  2. var userInput = document.formName.fieldName.value;  //This is how you would get it in Javascript though.
  3.  
  4. function mainFunction(userInput){
  5.     //Do whatever you want to do with userInput.
  6.    
  7.     secondFunction(100);
  8.     //Calling the secondFunction.
  9.    
  10.     function secondFunction(someValueIfNeeded){
  11.         //do whatever with someValueIfNeeded variable;
  12.         //This is second function.
  13.     }
  14. }
  15.  
  16. mainFunction(userInput); //calling the first function.
  17.  
  18. Thebot.net by atheus
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement