multiply.html
multiply.js
//multiply.html
<!DOCTYPE html>
<html>
<head>
<title>JavaScript example2</title>
<script src="multiply.js"type="text/javascript"></script>
</head>
<body>
<h1>The Amazing Multiplier</h1>
<div>
<input id="num1"type="text"size="3"/>*
<input id="num2"type="text"size="3"/>=
<span id="answer"></span><br/>
<button onclick="compute();">Compute!</button>
</div>
</body>
</html>
//multiply.js
function compute(){
var input1=document.getElementById("num1");
var input2=document.getElementById("num2");
var answer=document.getElementById("answer");
var result=input1.value*input2.value;
answer.innerHTML=result;
}