In: Computer Science
PRG/280 Week Three Assignment – Input Types and Form Designation
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="MyStyle.css">
</head>
<body>
<nav>
<a href="GroceryHome.html">Home</a> |
<a href="Products.html">Products</a> |
<a href="AboutUs.html">About Us</a> |
<a href="Contact.html">Contact</a>
</nav>
<header>
<h1> My Contact Page</h1>
</header>
<article>
Thank you for your interest in our grocery store. We offer delivery or call-ahead pickup services. Please provide your contact information, and indicate your family's food preferences.
</article> <p>
<form action="#" method="post" id="form1">
<div class="div1">
<label for="fname1" >First Name:</label><br>
<input type="text" name="firstname1" id="fname1"><br>
<label for="lname1" >Last Name:</label><br>
<input type="text" name="lastname1" id="lname1"><br>
<label for="phone1" >Phone (i.e. 123-456-7890):</label><br>
<input type="text" name="phone1" id="phone1" placeholder="123-456-7890" ><br>
<label for="email1" >Email:</label><br>
<input type="text" name="email1" id="email1" placeholder="abc@xyz"><br>
<label for="contactpreference1" >Prefered contact method?</label><br>
<input type="radio" name="contactpreference1" value="phone" checked> Phone
<input type="radio" name="contactpreference1" value="email"> Email
<br><br>
<input type="submit" id="Submit1" value="Submit" onclick=" validateMyPage()" />
</div>
</form>
I) HTML Input Types:
syntax: <input type='type'>
A) HTML5 Input Types:
Answers for HTML code snippet Questions:
a) The form is sent to the same page, which then processes the data etc.
b) we have to change form action to ='MAILTO:[email protected]'
Here is the new whole HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="MyStyle.css">
</head>
<body>
<nav>
<a href="GroceryHome.html">Home</a> |
<a href="Products.html">Products</a> |
<a href="AboutUs.html">About Us</a> |
<a href="Contact.html">Contact</a>
</nav>
<header>
<h1> My Contact Page</h1>
</header>
<article>
Thank you for your interest in our grocery store. We offer delivery
or call-ahead pickup services. Please provide your contact
information, and indicate your family's food preferences.
</article>
<p>
<form action="MAILTO:[email protected]" method="post"
id="form1">
<div class="div1">
<label for="fname1">First Name:</label><br>
<input type="text" name="firstname1"
id="fname1"><br>
<label for="lname1">Last Name:</label><br>
<input type="text" name="lastname1"
id="lname1"><br>
<label for="phone1">Phone (i.e.
123-456-7890):</label><br>
<input type="text" name="phone1" id="phone1"
placeholder="123-456-7890"><br>
<label for="email1">Email:</label><br>
<input type="text" name="email1" id="email1"
placeholder="abc@xyz"><br>
<label for="contactpreference1">Prefered contact
method?</label><br>
<input type="radio" name="contactpreference1" value="phone"
checked> Phone
<input type="radio" name="contactpreference1" value="email">
Email
<br><br>
<input type="submit" id="Submit1" value="Submit" onclick="
validateMyPage()" />
</div>
</form>