Categories
JavaScript

Multiply and Division of Two Numbers in JavaScript

 I wrote this simple program to ask the user to give two numbers and then the program will compute the product and quotient of two numbers using JavaScript programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following [email protected], [email protected], and [email protected]

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

<!DOCTYPE html>
<html> 
<head>
<meta charset=utf-8 />
<title>Multiply and Division of Two Numbers in JavaScript </title>
<style type="text/css">
body {
    background-color: lightgreen;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bolder;
    }
</style> 
</head>
<script>
    function multiply()
{
        num1 = document.getElementById("firstvalue").value;
        num2 = document.getElementById("secondvalue").value;
        document.getElementById("result").innerHTML = num1 * num2;
}

function divide()
{ 
        num1 = document.getElementById("firstvalue").value;
        num2 = document.getElementById("secondvalue").value;
        solve_divide = num1/num2;
        document.getElementById("result").innerHTML = solve_divide.toFixed(2);
}

function clear_all()
{
    document.getElementById("firstvalue").value="";
    document.getElementById("secondvalue").value="";
    document.getElementById("result").innerHTML = ""
    document.getElementById("firstvalue").focus();
}

</script>
<body>
   <h3>Multiply and Division of Two Numbers in JavaScript </h3>
   <p> Create By Mr. Jake R. Pomperada,MAED-IT, MIT </p><br>
<form>
First  Value  :  <input type="text" id="firstvalue" /><br>
Second Value  :  <input type="text" id="secondvalue" /><br><br>
<input type="button" onClick="multiply()" Value="Multiply" 
 title="Click here to multiply the two given numbers."/>
<input type="button" onClick="divide()" Value="Divide" 
title="Click here to divide two given numbers."/> &nbsp;
<input type="button" onClick="clear_all()" Value="Clear" 
title="Click here to clear the textbox."/>
</form><br>
<p>The Result is 
<span id = "result"></span>
</p>
</body>
</html>