Pass Form value to a function : Function Parameters : Function JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Function » Function Parameters »

 

Pass Form value to a function

















<HTML>
<HEAD>
   <TITLE>
   Add three numbers
   </TITLE>
   <SCRIPT>
   function addThreeNums (inOne, inTwo, inThree) {
      var inOne = Number(inOne);
      var inTwo = Number(inTwo);
      var inThree = Number(inThree);
      return Number(inOne + inTwo + inThree);
   }
   </SCRIPT>
</HEAD>
<BODY>
<FORM Name="theForm">
<INPUT Type=Text Name="num1">
<INPUT Type=Text Name="num2">
<INPUT Type=Text Name="num3">
<INPUT Type=Button Value="Add Them" 
onClick='document.write("sum:" +addThreeNums(theForm.num1.value,theForm.num2.value,theForm.num3.value));'>
</FORM>
</BODY>
</HTML>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Function
» Function Parameters