Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Q3.

As a developer, design the following web form for guest house


reservation at IGNOU.

HTML and JS Code:

<html>

<head>

<script>

function IGNOU() {

var fname =

document.forms["RegForm"]["First Name"];

var lname =

document.forms["RegForm"]["Last Name"];

var ID =

document.forms["RegForm"]["Govt. Issued- ID"];

var Arrival =

document.forms["RegForm"]["Date of Arrival"];

var Departure =

document.forms["RegForm"]["Date of Departure"];

var Country =

document.forms["RegForm"]["Country"];

var Persons =

document.forms["RegForm"]["Number of Persons"];
var Req =

document.forms["RegForm"]["Any special Request"];

var Payment =

document.forms["RegForm"]["Payment Method"];

if (fname.value == "") {

window.alert("Please enter your First Name.");

fname.focus();

return false;

if (lname.value == "") {

window.alert("Please enter your Last Name.");

name.focus();

return false;

if (ID.value == "") {

window.alert("Please enter Govt. Issued- ID.");


ID.focus();

return false;

if (Arrival.value == "") {

window.alert("Please enter Date of Arrival.");

Arrival.focus();

return false;

if (Departure.value == "") {

window.alert("Please enter Date of Departure.");

Departure.focus();

return false;

if (Country.value == "") {

window.alert("Please enter Date of Country.");

Country.focus();

return false;

if (Persons.value == "") {

window.alert("Please enter Number of Persons.");

Persons.focus();

return false;
}

if (Payment.value == "") {

window.alert("Please Select Payment Method.");

Payment.focus();

return false;

</script>

<style>

div {

box-sizing: border-box;

width: 100%;

border: 100px solid black;

float: left;

align-content: center;

align-items: center;

form {

margin: 0 auto;

width: 600px;
}

</style>

</head>

<body>

<h1 style="text-align: center;">IGNOU Guest House Reservation</h1>

<form name="RegForm" action="/submit.php"

onsubmit="return IGNOU()" method="post">

<p>First Name: <input type="text"

size="65" name="First Name" /></p>

<p>Last Name: <input type="text"

size="65" name="Last Name" /></p>

<p>Govt. Issued- ID: <input type="text"

size="40" name="Govt. Issued- ID" /></p>

<p>Date of Arrival: <input type="text"

size="30" name="Date of Arrival" /></p>

<p>Date of Departure: <input type="text"

size="30" name="Date of Departure" /></p>

<p>

Select Your Country


<select type="text" value="" name="COUNTRY">

<option>AMERICA</option>

<option>JAPAN</option>

<option>INDIA</option>

<option>CHINA</option>

<option>IRAN</option>

</select>

<p>Number of Persons: <input type="text"

size="15" name="Number of Persons"


/></p>

<p>Any special Request: <input type="text"

size="30" name="Any special Request"


/></p>

<label class=” “><b>Payment Method:</b></Label>

<br />

<label>

<br>

<input type="radio" name="gender" value="Debit"/> Debit

<br>

<input type="radio" name="gender" value="Credit"/> Credit <br/>


<br />

<br />

<input type="submit"

value="Submit" name="Submit" />

<input type="submit"

value="Cancel" name="submit" />

<input type="reset"

value="Reset" name="Reset" />

</p>

</form>

</body>

</html>
Output:

You might also like