Important Notice:

Posted On June 25, 2024

Practical Set 2 Question 2

0 comments
O Level Notes >> M2-R5.1 Practical Paper Solution >> Practical Set 2 Question 2

<!DOCTYPE html>

<html>

<head>

      <title>M2-R5.1 Set 2 Question 2</title>

</head>

<body>

      <center>

      <h1>JavaScript Output As Calculator</h1>

  1. A+B=<input type=”text” id=”add” disabled> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  2. A-B=<input type=”text” id=”sub” disabled><br><br><br><br>
  3. AxB=<input type=”text” id=”mul” disabled>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  4. A/B=<input type=”text” id=”div” disabled>

      </center>

<script type=”text/javascript”>

      var num1=parseInt(prompt(“Enter First Number “));

      var num2=parseInt(prompt(“Enter Second Number “));

      var a=num1+num2;

      document.getElementById(‘add’).value=a;

      var b=num1-num2;

      document.getElementById(‘sub’).value=b;

      var c=num1*num2;

      document.getElementById(‘mul’).value=c;

      var d=num1/num2;

      document.getElementById(‘div’).value=d;

</script>

</body>

</html>

Related Post

Practical Set 4 Question 1

Write HTML code to generate following outputCoffeeTeaBlack TeaGreen TeaMilk<!DOCTYPE html><html><head>     <title>M2-R5.1 Set 4 Question 1</title></head><body>         …

Practical Set 5 Question 1

Create a webpage, divide the webpage into six frames. In one frame create five links…

Practical Set 2 Question 1

Write a HTML code to divide browser window into two horizontal sections and play different…
error: Content is protected !!