Assignment 2 1
Assignment 2 1
Assignment – 2
---------------------------------------------------------------------------------------------------------------
1. Explain frame and its different type with example.
Frames
With frames, you can display more than one Web page in the same browser
window.
With frames, you can display more than one HTML document in the same
browser window.
Frameset Types
Vertical Frameset
<frameset cols="50%,50%">
<frame src="left.html">
<frame src="right.html">
</frameset>
Horizontal Frameset
Divide the browser window into horizontal sections
<frameset rows="50%,50%">
<frame src="top.html">
<frame src="bottom.html">
</frameset>
No Frames
Provide content for browsers that do not support frames.
<noframes>
Your browser does not support frames.
</noframes>
Mixed Frames
Combine horizontal and vertical frames in a nested manner.
<frameset rows="50%,50%">
<frame src="top.html">
<frameset cols="50%,50%">
<frame src="left.html">
<frame src="right.html">
</frameset>
</frameset>
Navigation frame
This example demonstrates how to make a navigation frame. The navigation
frame contains a list of links with the second frame as the target.
<frameset cols="120,*">
<frame src="tryhtml_contents.htm">
<frame src="frame_a.htm" name="showframe">
</frameset>
Inline Frame
Provide content for embedding external resources or documents within the
current webpage.
<iframe src="URL" width="600" height="400" title="description">
Your browser does not support inline frames.
</iframe>
<map name="worldmap">
</map>
The Image: The <img> tag displays the image and connects it to the map using usemap="#worldmap".
The Map: The <map> tag defines the clickable regions, with the name="worldmap" linking it to the usemap attribute of the image.
Rectangle (rect):
coords="x1,y1,x2,y2"
(x1, y1) is the top-left corner, and (x2, y2) is the bottom-right corner.
Circle (circle):
coords="x,y,r"
Polygon (poly):
coords="x1,y1,x2,y2,x3,y3,...,xn,yn"
The world-map.jpg image will display on the page with the following clickable regions:
A form in HTML is an element used to collect user input and send it to a server for processing. Forms are essential for interactive web pages,
enabling functionalities like login, registration, search, and more.
Forms are defined using the <form> tag, which can contain input elements such as text fields, radio buttons, checkboxes, drop-down menus,
and submit buttons.
Attributes of <form>
<label for="name">Name:</label>
<label for="email">Email:</label>
<label for="password">Password:</label>
</form>
Form Elements
<label for="username">Username:</label>
<label for="gender">Gender:</label><br>
<label for="male">Male</label><br>
<label for="female">Female</label><br><br>
<label for="hobbies">Hobbies:</label><br>
<label for="hobby1">Coding</label><br>
<label for="hobby2">Drawing</label><br><br>
<label for="country">Country:</label>
<option value="usa">USA</option>
<option value="india">India</option>
<option value="canada">Canada</option>
</select><br><br>
</form>
Key Notes
The <input> element in HTML is used to create interactive controls within a form. It allows users to enter different types of data, such as text, numbers, or
files, which can then be sent to a server for processing.
1. Text Input
Example:
2. Password Input
Example:
3. Email Input
Example:
<input type="email" name="email" placeholder="Enter your email">
4. Number Input
Example:
5. Date Input
Example:
6. Checkbox
Example:
7. Radio Button
Example:
8. File Input
Example:
9. Submit Button
Example:
Example:
11. Button
Example:
Example:
Example:
Example:
Example:
Example:
Example:
Example:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<label for="username">Name:</label>
<label for="email">Email:</label>
<label for="hobby">Hobbies:</label><br>
<label>Gender:</label><br>
</form>
</body>
</html>
2. name
o Assigns a name to the button, which can be used to reference it in scripts or identify it on the server when the form
is submitted.
Example:
<button name="submitBtn">Submit</button>
3. value
o Specifies the value that will be sent to the server when the button is clicked (if it's inside a form).
o Only applicable to submit and reset buttons.
Example:
<button type="submit" value="submitForm">Submit</button>
4. disabled
o Disables the button, making it unclickable and unresponsive.
Example:
<button disabled>Submit</button>
5. autofocus
o Automatically focuses the button when the page loads, allowing it to be clicked or activated without requiring the
user to click on it first.
Example:
<button autofocus>Click Me</button>
6. form
o Specifies the form to which the button belongs. This is useful when the button is outside the <form> tag but still
submits the form.
Example:
<form id="myForm">
<button form="myForm" type="submit">Submit</button>
</form>
7. formaction
o Specifies the URL to which the form data is submitted when the button is clicked (overrides the form’s action
attribute).
Example:
<button type="submit" formaction="submitForm.php">Submit</button>
8. formmethod
o Defines the HTTP method (GET or POST) to be used when submitting the form (overrides the form’s method
attribute).
Example:
<button type="submit" formmethod="POST">Submit</button>
9. formtarget
o Specifies where to display the response after form submission (overrides the form's target attribute).
Example:
<button type="submit" formtarget="_blank">Submit</button>
10. title
o Specifies extra information about the button, often displayed as a tooltip when the user hovers over the button.
Example:
<button title="Click to submit your form">Submit</button>
</body>
</html>
In this example:
The first button submits the form with a submit type.
The second button resets the form with a reset type.
The third button runs a custom JavaScript function when clicked.
The fourth button is disabled and cannot be clicked.
Key Points
The <button> element can be customized to perform different actions based on its type, onclick, and other
attributes.
It can be used for form submission, form reset, or custom JavaScript actions.
<form>
<label>
Name:
<input type="text" name="name">
</label><br><br>
<label>
Email:
<input type="email" name="email">
</label><br><br>
Explanation:
By wrapping the <input> inside a <label>, the label text and the input field are
grouped together, making the form more accessible and easier to navigate.
10. Create HTML form to enter employee details (First Name, Last Name, Email,
Mobile, Gender, Date of Birth, Marital Status, Hobby, Education, Languages known,
Country, State, and City, , Upload Photo, Additional Information, Submit, Reset).