WT Lab Exp 2
WT Lab Exp 2
AIM: Design web pages which makes use of data inputs like script, form &
bgsound.
Introduction to forms
An HTML form is a section of a document containing normal content, markup, special elements
called controls (checkboxes, radio buttons, menus, etc.), and labels on those controls. Users
generally "complete" a form by modifying its controls (entering text, selecting menu items, etc.),
before submitting the form to an agent for processing (e.g., to a Web server, to a mail server,
etc.)
Here's a simple form that includes labels, radio buttons, and push buttons (reset the form or
submit it):
<FORM action="http://somesite.com/prog/adduser" method="post">
<P>
<LABEL for="firstname">First name: </LABEL>
<INPUT type="text" id="firstname"><BR>
<LABEL for="lastname">Last name: </LABEL>
<INPUT type="text" id="lastname"><BR>
<LABEL for="email">email: </LABEL>
<INPUT type="text" id="email"><BR>
<INPUT type="radio" name="sex" value="Male"> Male<BR>
<INPUT type="radio" name="sex" value="Female"> Female<BR>
<INPUT type="submit" value="Send"><INPUT type="reset">
</P>
</FORM>
Input Methods
The HTML <form> element defines a form that is used to collect user input:
The <input> element is the most important form element.
The <input> element can be displayed in several ways, depending on the type attribute.
Here are some examples:
<input type="text"> Defines a one-line text input field
<input type="radio"> Defines a radio button (for selecting one of many choices)
<input type="submit">Defines a submit button (for submitting the form)
UID-15BCS1930
Group-1
Code:
<html>
<title> StarcK INDUSTRIES </title>
<body>
<h1> StarcK FX </h1>
<h2> SIGN UP </h2>
<form>
<fieldset>
<legend>Personal information:</legend>
FIRST NAME:<br>
<input type="text" name="firstname"placeholder="all capitals">
<br>
LAST NAME:<br>
<input type="text" name="lastname"placeholder="all capitals">
<br>
FATHER NAME:<br>
<input type="text" name="fathername"placeholder="all capitals">
<br>
DATE OF BIRTH:<br>
<input type="date"><br><br>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
<br>
CAR:<br>
<select name="CARS">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<br>
<audio controls>
<source src="C:\Users\dell\Music\auto.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio><br>
<br>
<button type="button" onClick="alert('hello world')">ALERT BOX</button><br><br>
<input type="submit" value="Submit">
</form>
<p>If you click the "Submit" button, the form-data will be sent to a page called
"action_page.php".</p>
</body>
</html>
UID-15BCS1930
Group-1
Output:
UID-15BCS1930
Group-1