Write a JavaScript program to display adding two numbers?

Program: <html> <script type="text/javascript">  function f(v1,v2) {             var fn=parseInt(v1); ...

Program:
<html>

<script type="text/javascript">
 function f(v1,v2)
{
            var fn=parseInt(v1);
            var sn=parseInt(v2);
            var res=fn+sn;
             alert("result =" +   res);
            sums.res1.value=res;
}
</script >

<body>

 <FORM NAME="sums">

     The sum of two numbers:

    <br>

   <pre>

          First number  <INPUT TYPE="text" NAME="first">

            <br>

          Second number <INPUT TYPE="text" NAME="second">

          <br>

          <INPUT TYPE="button" VALUE="sum"

          onClick="f(first.value,second.value)">   <INPUT TYPE="text" NAME="res1">

</form>

</body>

</html>




Output:-

sum of two numbers



Related

Web Technology 3053424233108186196

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item