<!doctype html>
<html lang=”en”>
<head>
<title>Principal Calculation Form</title>
<meta charset="utf-8"/>
<script src="code.js"></script>
</head>
<body onload="setFocus();">
<div class="container">
<div class="main">
<form action="#" method="post" name="form_name" id="form_id" class="form_class" >
<h2>--Principal Loan Form--</h2>
<h5>Disclaimer: This software by no mean will precisely predict your mortgage through your lender company. This Software will only assume the four items below in order to make an educated guess or prediction to your exact mortgage interests amount and the duration of your loan from your lender. <img src=”Hobbit.jpg” alt=”The image of my beloved Frodo” width="42" height="42"> </h5><hr />
<label>Principle :</label>
<input type="text" name="prin" id="prin" /><br/>
<br />
<img src=”pig.jpg” alt=”This is an image of a large pig” />
<input type="button" name="btn_id" id="btn_id" value="Submit" onclick="submitForm();"/>
</form>
</div>
</div>
</body>
</html>
1. What is the ID value for Button Type Input element in the code from above ?
2. When the button gets clicked, what is the JS function, which process the form data
3. What is the first JS Function which will execute when a browser loads the webpage in the above code?
4. Identified ALL the attribute(s) in the element called <img> ?
5. Identified ALL the value(s) in the element called <img> ?
Solutions with explanation
Ans. 1: Here in the above code,ID value for Button Type Input element is "btn_id"
Given in the following line of code in bold
<input type="button" name="btn_id" id="btn_id"
value="Submit" onclick="submitForm();"/>
Ans. 2: When the button gets clicked, the js
function which procees the form data is
submitForm().
The onclick attribute of the button will call the function
submitForm().
Given in the following line of code in bold
<input type="button" name="btn_id" id="btn_id" value="Submit"
onclick="submitForm();"/>
Ans. 3: The first JS Function which will
execute when a browser loads the webpage in the above code is
setFocus().
onload attribute of the body tag will execute the setFocus()
function.
Given in the following line of code in bold
<body onload="setFocus();">
Ans. 4: In the above code img element has been
used in two lines.
Attributes used in both the image elements are
src : which tells the about the source of the
image. Locally or in internet
alt : it it used to tell the alternative text for
an image when the image is not displayed due to some problem.
width : gives the width of the image
height : gives the height of the image
Given in the following lines of code in bold
<img src=”Hobbit.jpg” alt=”The
image of my beloved Frodo” width="42"
height="42">
<img src=”pig.jpg” alt=”This
is an image of a large pig” />
Ans. 5: img element has been used two times in
the above code
Values of first img element
src=”Hobbit.jpg”
alt=”The image of my beloved Frodo”
width="42"
height="42"
Values of the second img element
src=”pig.jpg”
alt=”This is an image of a large pig”
Get Answers For Free
Most questions answered within 1 hours.