Thursday, June 17, 2021

Product of Two Numbers in JavaScript

 A simple program to ask the user to give two numbers and then it will multiply the two given 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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

index.htm

<!doctype html>

<html>

<head>

<style>

      body {

      font-family: arial;

      font-size: 14px;

      background: lightgreen;

      }

</style>

<script>

function clear_all() {

document.getElementById("first").value ="";

document.getElementById("second").value ="";

document.getElementById("answer").value= "";

document.getElementById("first").focus();

}


function product(){

var a,b,c;

a=Number(document.getElementById("first").value);

b=Number(document.getElementById("second").value);

c= a * b;

document.getElementById("answer").value= c;

}

</script>

</head>

<body>

<h2>Product of Two Numbers in JavaScript </h2>

Enter the First number : <input id="first"><br><br>

Enter the Second number: <input id="second"><br><br>

The product <input id="answer"><br><br>

<button onclick="product()" title="Click here to solve the product.">

Solve</button>

<button onclick="clear_all()" title="Click here to clear the text box.">

Clear</button>

</body>

</html>


No comments:

Post a Comment