<!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" xml:lang="en" lang="en">
<head>
<title>Transitional DTD Template</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript">
<!-- HIDE HEAD CODE FROM INCOMPATIBLE BROWSERS
/*////////////////////////////////////////////////////////////////////////
PROGRAM INFORMATION
Programmer : Julie Dawson
Date : September 22, 2008
Name : Kudler_customer_demographic_form
Filename: jdawson_wk4part1.html
Purpose : wk 4 ind ass: complete change request #2
////////////////////////////////////////////////////////////////////////*/
STOP HIDING HEAD CODE FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body>
<script type="text/javascript">
<!-- HIDE BODY CODE FROM INCOMPATIBLE BROWSERS
function validateInformation() {
if (confirmSubmit() == false)
return false;
if (cookieInformationExists() == true) {
window.location = "formAlreadyFilled.html";
}
else {
setCookie();
return true;
return false;
}
return false;
}
function cookieInformationExists() {
if (document.cookie != "") {
splitCookie = document.cookie.split("; ");
userName = unescape(splitCookie[0].split("=")[1]);
if (userName == "") {
return false;
}
else {
if (userName!=kudler.name.value)
return false;
return true;
}
}
else {
return false;
}
return false;
}
function setCookie() {
var expiresDate = new Date();
expiresDate.setMonth(expiresDate.getMonth() + 6);
document.cookie = encodeURI("userName="+document.forms[0].name.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userAddress="+document.forms[0].address.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userCity="+document.forms[0].city.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userState="+document.forms[0].state.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userZip="+document.forms[0].zip.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userAreacode="+document.forms[0].areacode.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userExchange="+document.forms[0].exchange.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userPhone="+document.forms[0].phone.value)+";expires="+expiresDate.toUTCString();
document.cookie = encodeURI("userEmail="+document.forms[0].email.value)+";expires="+expiresDate.toUTCString();
return true;
}
function checkForNumber(fieldValue) {
var numberCheck = isNaN(fieldValue);
if (numberCheck == true) {
window.alert("You must enter a numeric value");
return false;
}
}
function confirmSubmit()
{
if (document.forms[0].name.value ==""
||document.forms[0].address.value ==""
||doument.forms[0].city.value ==""
||document.forms[0].state.value ==""
||document.forms[0].zip.value ==""
||document.forms[0].areacode.value ==""
||document.forms[0].exchange.value ==""
||document.forms[0].phone.value ==""
||document.forms[0].email.value ==""){
window.alert("You must complete form before submitting.");
return false;
}
return true;
}
// STOP HIDING BODY CODE FROM INCOMPATIBLE BROWSERS -->
</script>
<h1>Kudler Customer Demographic Information</h1>
<h2>Customer Mailing List</h2><hr/>
<form name="kudler" action="kudlerformprocessor.html" method="post" enctype="text/plain"
onsubmit="return validateInformation(this)">
<p>Name (ex. George Bush)<br/>
<input type="text" name="name" size="30"/></p>
<p>Address (ex. 1600 Pennsylvania Ave NW)<br/>
<input type="text" name="address" size="50"/></p>
<p>City, State, Zip (ex. Washington, DC 20500)<br/>
<input type="text" name="city" size="20"/>
<input type="text" name="state" size="20"/>
<input type="text" name="zip" size="7"
onchange="return checkForNumber(this.value);"/></p>
<p>E-Mail Address (ex. GWB@whitehouse.gov)<br/>
<input type="text" name="email" size="50"/></p>
<p>Daytime Phone Number (ex. (202) 456-1111)<br/>
(<input type="text" name="areacode" size="3" maxlength="3"
onchange="return checkForNumber(this.value);"/>)
<input type="text" name="exchange" size="3" maxlength="3"
onchange="return checkForNumber(this.value);"/>
<input type="text" name="phone" size="4" maxlength="4"
onchange="return checkForNumber(this.value);"/></p>
<p><input type="submit" value="Submit Info"/>
<input type="reset"/></p>
</form>
</body>
</html>
Mod Edit: Please use code tags when posting your code. Code tags are used like so =>
Thanks,
PsychoCoder

New Topic/Question
Reply



MultiQuote





|