hey all, ive got a form which ive posted about in another thread here but now i need some help with how to make an extension of the form
the plan is that when the user selects an option with a radio button it opens up a div with details about the type of payment
example: when they click on the radio button "credit card" the credit layer appears below and allows them to enter the credit card details
same thing with a paypal button and a direct deposit button.
heres what ive got so far but i cant figure out how to make the div open within the html page (perhaps an array?) so yeah any tips on how to do it even if you dont have a solution im happy to try it out
html
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--- Created by Nick Hayden (29/07/2010) -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Little Bean Order Form</title>
<script language="javascript" src="../javascript/script.js" ></script>
<link href="../stylesheet/coffee.css" rel="stylesheet" type="text/css" >
<style type="text/css">
body
{
background-color:#FF6600;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12pt;
}
</style>
</head>
<body>
<div id="header"><a href="../homepage.html"> <img src="../images/coffeebeans.jpg" alt="Coffee Shop Header"
height="100" width="960" /></a></div>
<div id="navigation"><p>
<img src="../images/coffee-bean.png" alt="Coffee Bean Navigation Image" width="50" />
<br />
<a href="../homepage.html">Home</a>
<br /><br />
<img src="../images/coffee-bean.png" alt="Coffee Bean Navigation Image" width="50" />
<br />
<a href="../html/coffee.html">Coffee</a>
<br /><br />
<img src="../images/coffee-bean.png" alt="Coffee Bean Navigation Image" width="50" />
<br />
<a href="../html/menu.html">Menu</a>
<br /><br />
</p></div>
<div id="content">
<h1 align="center" style="color:#CC3300">Order Form</h1>
<hr />
<form align="justify" name="orderform" id="order" onSubmit="return checkform(this)">
<p>
First Name:
<input type="text" name="fname" />
Last Name:
<input type="text" name="lname" value=""/><br /><br />
Address:
<input type="text" name="address" value="" />
Suburb:
<input type="text" name="suburb" value="" /><br /><br />
State
<select name="state">
<option>Please select your State</option>
<option>Australian Capital Territory (ACT)</option>
<option>New South Wales (NSW)</option>
<option>Northern Territory (NT)</option>
<option>Queensland (QLD)</option>
<option>South Australia (SA)</option>
<option>Tasmania (TAS)</option>
<option>Victoria (VIC)</option>
<option>Western Australia (WA)</option>
</select>
Postcode:
<input type="text" name="postcode" value="" maxlength="4"/><br /><br />
Email:
<input type="text" name="email" value="" />
Phone Number:
<input type="text" name="phone" value="" maxlength="10" /><br /><br />
<hr />
Order:<br />
<textarea rows="10" cols="70" name="order" value="" ></textarea>
<br /><br />
<hr />
Select Payment:<br />
<input type="radio" name="payment" value="credit" onclick="cclayer()"/> Credit Card<br />
<input type="radio" name="payment" value="paypal" /> Paypal <br />
<input type="radio" name="payment" value="bank" /> Online Baking <br />
<hr />
<input type="submit" value="Submit Order" name="submit" />
<input type="reset" value="Reset Form" name="cancel" />
</form>
</div>
<div id="footer">
<p><a href="../html/contact.html">Contact Us</a> | <a href="../html/copyright.html">Copyright</a> | <a href="../html/privacy.html">Privacy</a> | <a href="mailto:nickhayden1992@gmail.com">Web Administrator</a></p>
</div>
</body>
</html>
javascript
Code:
function checkform ( form )
{
if (form.fname.value == "")
{
alert ( "Please Enter Your First Name." );
form.fname.focus();
return false;
}
if (form.lname.value == "")
{
alert ( "Please enter your Last Name." );
form.lname.focus();
return false;
}
if (form.address.value == "")
{
alert ( "Please enter your Address." );
form.address.focus();
return false;
}
if (form.suburb.value == "")
{
alert ( "Please enter your Suburb." );
form.suburb.focus();
return false;
}
if (form.state.value == "Please select your State" )
{
alert ( "Please choose your State" );
form.state.focus();
return false;
}
if (form.postcode.value == "" )
{
alert ("Please enter your Postcode" );
form.postcode.focus();
return false;
}
/*if (form.postcode.value = isNaN())
{
alert ("Please enter only numbers for your Postcode");
form.postcode.focus();
return false;
}
else
{
return true;
}*/
if (form.email.value == "")
{
alert ("Please enter your Email" );
form.email.focus();
return false;
}
if (form.phone.value == "")
{
alert ("Please enter your Phonenumber" );
form.phone.focus();
return false;
}
if (form.phone.value = isNaN())
{
alert ("Please enter only numbers for your Phonenumber");
form.phone.focus();
return false;
}
if (form.order.value == "")
{
alert ( "Please enter your Order" );
form.order.focus();
return false;
}
return true;
}
function cclayer()
{
document.write('<link href="../stylesheet/coffee.css" rel="stylesheet" type="text/css" / ><div id="footer"><p><a href="../html/contact.html">Contact Us </a> | <a href="../html/copyright.html">Copyright</a> | <a href="../html/privacy.html">Privacy</a> | <a href="mailto:nickhayden1992@gmail.com">Web Administrator</a></p>')
}
css
Code:
body
{
background-color:#FF6600;
font-family:Arial, Helvetica, sans-serif;
font-size:12pt;
color:#282828;
}
h1
{
text-align:center;
color:#CC3300;
}
p
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12pt;
color:#282828;
}
p.content:first-letter
{
font-size:14pt;
font-style:italic;
}
a
{
color:#336666;
text-decoration:underline;
}
a:visited
{
color:#274828;
text-decoration:underline;
}
a:hover
{
color:#006600;
text-decoration:none;
}
a:active
{
color:#003300;
}
#header
{
width:960px;
height:100px;
}
#content
{
width:810px;
vertical-align:top;
position:relative;
margin:-270px 0px 0px 150px;
}
#navigation
{
width:150px;
vertical-align:top;
text-align:center;
margin-top:50px;
}
#footer
{
text-align:center;
font-size:10pt;
}
div#navigation a span
{
display:none;
}
div#navigation a:hover span
{
display:block;
position:absolute;
margin:170px 0px 0px 10px;
font-size:12pt;
color:#282828;
}
#cclayer
{
}
|