Saturday, June 18, 2022

CALCULATOR IN JAVASCRIPT

<html>
<head>
<title> JS </title>
</head>
<body>
<form name="example">
<input type="text" size="20" name="calculator">
<input type="button" name="B1" value="calculate" onclick="cal()">
<input type="reset" name="B2" value="reset">
Answer: <input type="text" size="20" name="answer">
</form>
</body>
<script>
function cal()
{
document.example.answer.value= eval(document.example.calculator.value)
}
</script>
</html> 




No comments:

Post a Comment

MCQ QUESTIONS

Loading…