HTML 5 Simple Calculator Code Solution
Create the following Web page with the heading ‘Calculator’ and provided images.
The web page should contain the following input elements and apply the specified Constraints:
| Label Name | Element Name | Constraints |
|---|---|---|
| Input1 | input1 | This element is to get the first input. Type should be ‘number’ |
| Input2 | input2 | This element is to get the second input. Type should be ‘number’ |
| Select Operation | operation | A drop-down list contains the following values: Select.. , ADD, SUBTRACT, MULTIPLY and DIVIDE.Set these values as its option tag text and option tag’s ‘value’ attributes |
| submit | An image tag with the source as calc.jpg should be displayed | |
| reset | An image tag with the source as reset.jpg should be displayed |
Consider the images are in the current folder and
- Use “calculator.jpg” as a header image.
Apply the following styles to the attributes:
- Do not use CSS.
- The heading should be done using the font color ‘blue’ and with a font size of ’20’. (Use <font> tag)
- The height and width of the images with the name “submit” and “reset” should be ’80’.
- The height and width of the calculator image should be ‘300’ and ‘400’.
Calculator.html
<html>
<head>
<title>Calculator</title>
</head>
<body>
<font color="blue" size="20">Calculator</font>
<img id="hero" src="calculator.jpg" alt="calc hero" height="300" width="400"/>
input1 <input type="number" name="input1">
input2 <input type="number" name="input2">
Select Operation <select name="operation">
<option>Select..</option>
<option>ADD</option>
<option>SUBTRACT</option>
<option>MULTIPLY</option>
<option>DIVIDE</option>
</select>
<div>
<div><img src="calc.jpg" height="80" width="80"/></div>
<div><img src="reset.jpg" height="80" width="80"/></div>
</div>
</body>
</html>
