A friend of mine ask me to help her with a problem the thing is i have not done javascript in many years now. I cant seem to get the loop to run
Question
Write an algorithm that takes two numbers and calculates the
product of the numbers using the binary operator '+' only i.e. the
algorithm should NOT use the binary operator 'x'.
Solution
<html>
<head>
<title>
Calculator
</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function doMath() {
var one = eval(document.theForm.elements[0].value)
var two = eval(document.theForm.elements[1].value)
count = 0
while (count<=two)
{
var prod = one + one
count == count +1
}
alert("The product of " + one + " and " +
two + " is " + prod + ".")
}
// End -->
</SCRIPT>
</head>
<body>
<CENTER>
<FORM NAME="theForm">
Multiply
<INPUT TYPE="text">
By
<INPUT TYPE="text">
<INPUT TYPE="button" VALUE="Show result" onClick="doMath()">
</FORM>
</CENTER>
</body>
</html>