Jump to content

need addition subtraction script for webpage


GEOSKY

Recommended Posts

THIS DOES NOT WORK

<html>

<head>

<title>JavaScript: calculate two numbers</title>

    <script>
    
        function calme()
        {
            var a,b,c;
            a=Number (document.getElementById('a').value);
            b=Number (document.getElementById('b').value);
            c=a+b;
            document.getElementById ("x").innerHTML ="Total:"+c;
        }    
        function clr()
            document.getElementById ("x").innerHTML=""
            document.getElementById ("a").value=""
            document.getElementById ("b").value=""
            

    </script>
    
</head>

<body>
<p>www.Tutorjoes.com</p>

    Enter A Value :<input id="a" type="text" />
    Enter B Value :<input id="b" type="text" />
    <button onclick="calme();">Click Me</button>
    <button onclick="clr();">Clear</button>
    <p id="x"></p>
    
    
    
    
    
    
</body>

</html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...