PLEASE CHECK FOR ME!THX(FOLLOWINS ARE CODE FROM CTRL+A)<html><head>
<title>order</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function requiredFields(fieldName,fieldValue) {
if (fieldValue=="") {
alert(fieldName + " is a required field.");
return false;
}
else {
return true;
}
}function updateTotalPrice() {
var nameTemp = document.catalogue.quantity.name;
var quantityTemp = document.catalogue.quantity.value;
var priceTemp = document.catalogue.eachprice.value;
if (requiredFields(nameTemp,quantityTemp)) {
quantityTemp = parseInt(quantityTemp);
document.catalogue.price.value = "$ " + quantityTemp * priceTemp;
}
}function updatePrice() {
var indexNum = catalogue.productcode.selectedIndex;
switch (indexNum) {
case 1:
catalogue.eachprice.value = 54;
updateTotalPrice();
return true;
break;
case 2:
catalogue.eachprice.value = 89;
updateTotalPrice();
return true;
break;
case 3:
catalogue.eachprice.value = 28;
updateTotalPrice();
return true;
break;
case 4:
catalogue.eachprice.value = 320;
updateTotalPrice();
return true;
break;
default:
catalogue.eachprice.value = "0";
updateTotalPrice();
alert("Please select a product title");
return false;
}
}function checkRange(rangeName,rangeValue,lowrange,highrange) {
var quantitynum, pricenum;
if (requiredFields(rangeName,rangeValue)) {
quantitynum = parseInt(rangeValue);
if ((quantitynum < lowrange) || (quantitynum > highrange)) {
alert("The " + rangeName+ " of your order must be for a minimum of " + lowrange + " products and a maximum of " + highrange + " products; order outside this range, please process through traditional channel.");
document.catalogue.quantity.value = "";
return false;
}
else {
updateTotalPrice();
return true;
}
}
}function checkField() {
if (catalogue.customername.value == "") {
alert("Please Enter Your Name");
catalogue.customername.focus();
return (false);
}
else if (catalogue.address.value == ""){
alert("Please Enter Your Postal Address");
catalogue.address.focus();
return (false);
}
else if (catalogue.suburb.value == ""){
alert("Please Enter Suburb Name");
catalogue.suburb.focus();
return (false);
}else if (catalogue.state.value == ""){
alert("Please Enter State Name");
catalogue.state.focus();
return (false);
}else if (catalogue.postcode.value == ""){
alert("Please Enter Postcode");
catalogue.postcode.focus();
return (false);
}else if (catalogue.email.value == "") {
alert("Please Enter the Email Address");
catalogue.email.focus();
return (false);
}else if (catalogue.phone.value == "") {
alert("Please Enter the Phone Number");
catalogue.phone.focus();
return (false);
}else if (catalogue.fax.value == "") {
alert("Please Enter the Fax Number");
catalogue.fax.focus();
return (false);
}else {
return true;
}
}function checkPhoneFax(name,value) {
if ( (value.length != 8) || (!isNaN("value")) || (value.length !=8) || (!isNaN("value"))) {
alert("The " + name + " is not a valid number. Please try again.");
return false;
}
else{
return true;
}
}function processOrder() {
var check1 , check2 , check3;
check1 = check2 = check3 = false;
check1 = updatePrice();
check2 = checkRange(document.catalogue.quantity.name, document.catalogue.quantity.value,10,100);
check3 = checkField();
if ((!check1) || (!check2) || (!check3)) {
alert("Your order cannot be submitted until you complete all required fields");
return false;
}
else {
alert("Your order has been processed succesfully");
return true;
}
}
//-->
</script>
</head>
<title>order</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function requiredFields(fieldName,fieldValue) {
if (fieldValue=="") {
alert(fieldName + " is a required field.");
return false;
}
else {
return true;
}
}function updateTotalPrice() {
var nameTemp = document.catalogue.quantity.name;
var quantityTemp = document.catalogue.quantity.value;
var priceTemp = document.catalogue.eachprice.value;
if (requiredFields(nameTemp,quantityTemp)) {
quantityTemp = parseInt(quantityTemp);
document.catalogue.price.value = "$ " + quantityTemp * priceTemp;
}
}function updatePrice() {
var indexNum = catalogue.productcode.selectedIndex;
switch (indexNum) {
case 1:
catalogue.eachprice.value = 54;
updateTotalPrice();
return true;
break;
case 2:
catalogue.eachprice.value = 89;
updateTotalPrice();
return true;
break;
case 3:
catalogue.eachprice.value = 28;
updateTotalPrice();
return true;
break;
case 4:
catalogue.eachprice.value = 320;
updateTotalPrice();
return true;
break;
default:
catalogue.eachprice.value = "0";
updateTotalPrice();
alert("Please select a product title");
return false;
}
}function checkRange(rangeName,rangeValue,lowrange,highrange) {
var quantitynum, pricenum;
if (requiredFields(rangeName,rangeValue)) {
quantitynum = parseInt(rangeValue);
if ((quantitynum < lowrange) || (quantitynum > highrange)) {
alert("The " + rangeName+ " of your order must be for a minimum of " + lowrange + " products and a maximum of " + highrange + " products; order outside this range, please process through traditional channel.");
document.catalogue.quantity.value = "";
return false;
}
else {
updateTotalPrice();
return true;
}
}
}function checkField() {
if (catalogue.customername.value == "") {
alert("Please Enter Your Name");
catalogue.customername.focus();
return (false);
}
else if (catalogue.address.value == ""){
alert("Please Enter Your Postal Address");
catalogue.address.focus();
return (false);
}
else if (catalogue.suburb.value == ""){
alert("Please Enter Suburb Name");
catalogue.suburb.focus();
return (false);
}else if (catalogue.state.value == ""){
alert("Please Enter State Name");
catalogue.state.focus();
return (false);
}else if (catalogue.postcode.value == ""){
alert("Please Enter Postcode");
catalogue.postcode.focus();
return (false);
}else if (catalogue.email.value == "") {
alert("Please Enter the Email Address");
catalogue.email.focus();
return (false);
}else if (catalogue.phone.value == "") {
alert("Please Enter the Phone Number");
catalogue.phone.focus();
return (false);
}else if (catalogue.fax.value == "") {
alert("Please Enter the Fax Number");
catalogue.fax.focus();
return (false);
}else {
return true;
}
}function checkPhoneFax(name,value) {
if ( (value.length != 8) || (!isNaN("value")) || (value.length !=8) || (!isNaN("value"))) {
alert("The " + name + " is not a valid number. Please try again.");
return false;
}
else{
return true;
}
}function processOrder() {
var check1 , check2 , check3;
check1 = check2 = check3 = false;
check1 = updatePrice();
check2 = checkRange(document.catalogue.quantity.name, document.catalogue.quantity.value,10,100);
check3 = checkField();
if ((!check1) || (!check2) || (!check3)) {
alert("Your order cannot be submitted until you complete all required fields");
return false;
}
else {
alert("Your order has been processed succesfully");
return true;
}
}
//-->
</script>
</head>
<form name="catalogue" action="http://130.102.196.65/Scripts/SendMail.asp"
ONSUBMIT="return processOrder()" method="post">
<INPUT TYPE="hidden" NAME="recipient" VALUE="[email protected]">
<INPUT TYPE="hidden" NAME="subject" VALUE="Order Form">
<INPUT TYPE="hidden" NAME="Return URL" VALUE="http://student.uq.edu.au/~s4000812">
<INPUT TYPE="hidden" NAME="Return Link Text" VALUE="Return to the Homepage">
<INPUT TYPE="hidden" NAME="Show Results" VALUE="Yes">
<INPUT TYPE="hidden" NAME="Toggle Graphics" VALUE="Off"> <div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="881" height="529">
<tr>
<td width="367" height="36">
<p align="center"><b><font color="#660000" face="Arial, Helvetica, sans-serif" size="5">
ORDER FORM</font></b>
</td>
<td width="323" height="36">
</td>
</tr>
<tr>
<td width="368" height="493">
<table border="0" cellpadding="0" cellspacing="0" width="542" height="456">
<tr>
<td width="171" valign="top" height="27" ><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Select
Product:</font></b></td> <td width="197"> <select name="productcode" onchange="updatePrice()">
<option value="blank">Please select a product</option>
<option value="p1">Pink Bouquet</option>
<option value="p2">Teddy Bear</option>
<option value="p3">Chocolate</option>
<option value="p4">Xbox</option>
</select>
</td>
</tr>
<tr>
<td width="171" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Enter
Quantity:</font></b></td>
<td width="367" height="27"><input type="text" name="quantity" size="3" value="0"
onchange="checkRange(this.name,this.value,10,100)"></td>
</tr>
<tr>
<td width="171" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Price:</font></b></td>
<td width="367" height="27"><input type="text" name="eachprice" size="8"></td>
</tr>
<tr>
<td width="171" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Total
Price:</font></b></td>
<td width="367" height="27"><input type="text" name="price" size="8"></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Delivery
Date:</font></b></td>
<td width="367" height="28"><input type="text" name="deliverydate" size="13" value="DD/MM/YYYY"></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Customer
Name:</font></b></td>
<td width="367" height="28"><input type="text" name="customername" size=40></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Postal Address:</font></b></td>
<td width="367" height="28"><input type="text" name="address" size=40></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Suburb:</font></b></td>
<td width="367" height="28"><input type="text" name="suburb" size="40"></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">State:</font></b></td>
<td width="367" height="28"><input type="text" name="state" size=10></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Postcode:</font></b></td>
<td width="367" height="28"><input type="type" name="postcode" size=10></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">E-mail:</font></b></td>
<td width="367" height="28"><input type="text" name="email" size=20 onblur="requiredFields(this.name, this.value)"></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Phone:</font></b></td>
<td width="367" height="28"><input type="text" name="phone" size=12 onblur="checkPhoneFax(this.name, this.value)"></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Fax:</font></b></td>
<td width="367" height="28"><input type="text" name="fax" size=12 onblur="checkPhoneFax(this.name, this.value)"></td>
</tr>
<tr>
<td width="540" colspan="2" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Prefer
Contact method:</font></b></td>
</tr>
<tr>
<td width="540" height="28" colspan="2">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="73">
<tr>
<td width="28%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">E-mail
<input type=radio name="preferredcontact" value="remail" checked></font></b></td>
<td width="27%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Phone
<input type=radio name="preferredcontact" value="rphone"></font></b></td>
<td width="23%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Fax
<input type=radio name="preferredcontact" value="rfax"></font></b></td>
<td width="22%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Mail
<input type=radio name=preferredcontact value="rmail"></font></b></td>
</tr>
<tr>
<td width="55%" colspan="2" height="19"></td>
<td width="45%" height="19" colspan="2"></td>
</tr>
<tr>
<td width="26%" height="27"></td>
<td width="29%" height="27"><input type="submit" name="submit" value="Submit"></td>
<td width="45%" height="27" colspan="2"><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</td>
<td width="322" height="493">
</td>
</tr>
</table>
</center>
</div></body></html>
The following is just some defect of your web page.1.Some validation procedures occur as soon as the relevant
information is entered (onchange). If customers enter an errror data ,
though you display a message ,but the customer can still submit the form .
2.If the information is not full, you display too many messages.
3.Your function checking the e-mail is too simple , a wrong e-mail can also
pass.
4.If i input a wrong quantity or a wrong date ,the form can be submited.
<title>order</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function requiredFields(fieldName,fieldValue) {
if (fieldValue=="") {
alert(fieldName + " is a required field.");
return false;
}
else {
return true;
}
}function updateTotalPrice() {
var nameTemp = document.catalogue.quantity.name;
var quantityTemp = document.catalogue.quantity.value;
if(quantityTemp == "" || isNaN(quantityTemp))
return;
var priceTemp = document.catalogue.eachprice.value;
if (requiredFields(nameTemp,quantityTemp)) {
quantityTemp = parseInt(quantityTemp);
document.catalogue.price.value = "$ " + quantityTemp * priceTemp;
}
}function updatePrice() {
var indexNum = catalogue.productcode.selectedIndex;
switch (indexNum) {
case 1:
catalogue.eachprice.value = 54;
updateTotalPrice();
return true;
break;
case 2:
catalogue.eachprice.value = 89;
updateTotalPrice();
return true;
break;
case 3:
catalogue.eachprice.value = 28;
updateTotalPrice();
return true;
break;
case 4:
catalogue.eachprice.value = 320;
updateTotalPrice();
return true;
break;
default:
catalogue.eachprice.value = "0";
updateTotalPrice();
//alert("Please select a product title");
return false; }
}function checkRange(rangeName,rangeValue,lowrange,highrange) {
var quantitynum, pricenum;
if (rangeValue != "" && !isNaN(rangeValue)) {
quantitynum = parseInt(rangeValue);
if ((quantitynum < lowrange) || (quantitynum > highrange)) {
alert("The " + rangeName+ " of your order must be for a minimum of " + lowrange + " products and a maximum of " + highrange + " products; order outside this range, please process through traditional channel.");
catalogue.quantity.value = "";
catalogue.quantity.focus();
window.event.returnValue = false;
}
else {
document.catalogue.quantity.value = parseInt(rangeValue);
updateTotalPrice();
return true;
}
}
}function checkField() {
if(catalogue.productcode.selectedIndex == 0){
alert("Please select a product title");
return false;
}
if (catalogue.customername.value == "") {
alert("Please Enter Your Name");
catalogue.customername.focus();
return (false);
}
if (catalogue.address.value == ""){
alert("Please Enter Your Postal Address");
catalogue.address.focus();
return (false);
}
if (catalogue.suburb.value == ""){
alert("Please Enter Suburb Name");
catalogue.suburb.focus();
return (false);
}
if (catalogue.state.value == ""){
alert("Please Enter State Name");
catalogue.state.focus();
return (false);
}
if (catalogue.postcode.value == ""){
alert("Please Enter Postcode");
catalogue.postcode.focus();
return (false);
}
if (catalogue.email.value == "") {
alert("Please Enter the Email Address");
catalogue.email.focus();
return (false);
}
var rs = /(.*)@(.*).(.*)/;
if(!rs.test(catalogue.email.value))
{
alert("Please Enter a true Email Address");
catalogue.email.focus();
return false;
}
if (catalogue.phone.value == "") {
alert("Please Enter the Phone Number");
catalogue.phone.focus();
return (false);
}
if(!checkPhoneFax("phone",catalogue.phone.value)){
catalogue.phone.focus();
return false;
}
if (catalogue.fax.value == "") {
alert("Please Enter the Fax Number");
catalogue.fax.focus();
return (false);
}
if(!checkPhoneFax("fax",catalogue.fax.value)){
catalogue.fax.focus();
return false;
}
return true;}function checkPhoneFax(name,value) {
if ( (value.length != 8) || (!isNaN("value")) || (value.length !=8) || (!isNaN("value"))) {
alert("The " + name + " is not a valid number. Please try again.");
return false;
}
else{
return true;
}
}function processOrder() {
var check1 , check2 , check3;
check1 = check2 = check3 = false;
//check1 = updatePrice();
//check2 = checkRange(document.catalogue.quantity.name, document.catalogue.quantity.value,10,100);
check3 = checkField();
if (!check3) {
//alert("Your order cannot be submitted until you complete all required fields");
return false;
}
else {
alert("Your order has been processed succesfully");
return true;
}
}
//-->
</script>
</head>
<body background="flower bg.jpg" bgproperties="fixed">
<form name="catalogue" action="http://130.102.196.65/Scripts/SendMail.asp"
ONSUBMIT="return processOrder()" method="post">
<INPUT TYPE="hidden" NAME="recipient" VALUE="[email protected]">
<INPUT TYPE="hidden" NAME="subject" VALUE="Order Form">
<INPUT TYPE="hidden" NAME="Return URL" VALUE="http://student.uq.edu.au/~s4000812">
<INPUT TYPE="hidden" NAME="Return Link Text" VALUE="Return to the Homepage">
<INPUT TYPE="hidden" NAME="Show Results" VALUE="Yes">
<INPUT TYPE="hidden" NAME="Toggle Graphics" VALUE="Off"> <div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="881" height="529">
<tr>
<td width="367" height="36">
<p align="center"><b><font color="#660000" face="Arial, Helvetica, sans-serif" size="5">
ORDER FORM</font></b>
</td>
<td width="323" height="36">
</td>
</tr>
<tr>
<td width="368" height="493">
<table border="0" cellpadding="0" cellspacing="0" width="542" height="456">
<tr>
<td width="171" valign="top" height="27" ><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Select
Product:</font></b></td> <td width="197"> <select name="productcode" onchange="updatePrice()">
<option value="blank">Please select a product</option>
<option value="p1">Pink Bouquet</option>
<option value="p2">Teddy Bear</option>
<option value="p3">Chocolate</option>
<option value="p4">Xbox</option>
</select>
</td>
</tr>
<tr>
<td width="171" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Enter
Quantity:</font></b></td>
<td width="367" height="27"><input type="text" name="quantity" size="3"
onchange="checkRange(this.name,this.value,10,100)"></td>
</tr>
<tr>
<td width="171" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Price:</font></b></td>
<td width="367" height="27"><input type="text" name="eachprice" size="8" readonly></td>
</tr>
<tr>
<td width="171" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Total
Price:</font></b></td>
<td width="367" height="27"><input type="text" name="price" size="8" readonly></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Delivery
Date:</font></b></td>
<td width="367" height="28"><input type="text" name="deliverydate" size="13" value="DD/MM/YYYY"></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Customer
Name:</font></b></td>
<td width="367" height="28"><input type="text" name="customername" size=40></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Postal Address:</font></b></td>
<td width="367" height="28"><input type="text" name="address" size=40></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Suburb:</font></b></td>
<td width="367" height="28"><input type="text" name="suburb" size="40"></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">State:</font></b></td>
<td width="367" height="28"><input type="text" name="state" size=10></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Postcode:</font></b></td>
<td width="367" height="28"><input type="type" name="postcode" size=10></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">E-mail:</font></b></td>
<td width="367" height="28"><input type="text" name="email" size=20 ></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Phone:</font></b></td>
<td width="367" height="28"><input type="text" name="phone" size=12 ></td>
</tr>
<tr>
<td width="171" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Fax:</font></b></td>
<td width="367" height="28"><input type="text" name="fax" size=12 ></td>
</tr>
<tr>
<td width="540" colspan="2" height="28"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Prefer
Contact method:</font></b></td>
</tr>
<tr>
<td width="540" height="28" colspan="2">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="73">
<tr>
<td width="28%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">E-mail
<input type=radio name="preferredcontact" value="remail" checked></font></b></td>
<td width="27%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Phone
<input type=radio name="preferredcontact" value="rphone"></font></b></td>
<td width="23%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Fax
<input type=radio name="preferredcontact" value="rfax"></font></b></td>
<td width="22%" height="27"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#660066" size="3">Mail
<input type=radio name=preferredcontact value="rmail"></font></b></td>
</tr>
<tr>
<td width="55%" colspan="2" height="19"></td>
<td width="45%" height="19" colspan="2"></td>
</tr>
<tr>
<td width="26%" height="27"></td>
<td width="29%" height="27"><input type="submit" name="submit" value="Submit"></td>
<td width="45%" height="27" colspan="2"><input type="reset" name="reset" value="Reset"></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</td>
<td width="322" height="493">
</td>
</tr>
</table>
</center>
</div></form></body></html>
<title>order</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function requiredFields(fieldName,fieldValue) {
if (fieldValue=="") {
alert(fieldName + " is a required field.");
return false;
}
else {
return true;
}
}function updateTotalPrice() {
var nameTemp = document.catalogue.quantity.name;
var quantityTemp = document.catalogue.quantity.value;
if(quantityTemp == "" || isNaN(quantityTemp))
return;
var priceTemp = document.catalogue.eachprice.value;
if (requiredFields(nameTemp,quantityTemp)) {
quantityTemp = parseInt(quantityTemp);
document.catalogue.price.value = "$ " + quantityTemp * priceTemp;
}
}function updatePrice() {
var indexNum = catalogue.productcode.selectedIndex;
switch (indexNum) {
case 1:
catalogue.eachprice.value = 54;
updateTotalPrice();
return true;
break;
case 2:
catalogue.eachprice.value = 89;
updateTotalPrice();
return true;
break;
case 3:
catalogue.eachprice.value = 28;
updateTotalPrice();
return true;
break;
case 4:
catalogue.eachprice.value = 320;
updateTotalPrice();
return true;
break;
default:
catalogue.eachprice.value = "0";
updateTotalPrice();
//alert("Please select a product title");
return false; }
}function checkRange(rangeName,rangeValue,lowrange,highrange) {
var quantitynum, pricenum;
if (rangeValue != "" && !isNaN(rangeValue)) {
quantitynum = parseInt(rangeValue);
if ((quantitynum < lowrange) || (quantitynum > highrange)) {
alert("The " + rangeName+ " of your order must be for a minimum of " + lowrange + " products and a maximum of " + highrange + " products; order outside this range, please process through traditional channel.");
catalogue.quantity.value = "";
catalogue.quantity.focus();
window.event.returnValue = false;
}
else {
document.catalogue.quantity.value = parseInt(rangeValue);
updateTotalPrice();
return true;
}
}else if (isNaN(rangeValue)){
alert("The quantity is not correct");
catalogue.quantity.value = "";
catalogue.quantity.focus();
window.event.returnValue = false;
}
}function checkField() {
if(catalogue.productcode.selectedIndex == 0){
alert("Please select a product title");
return false;
}
if (catalogue.quantity.value == "" || isNaN(catalogue.quantity.value)) {
alert("Please Enter the correct quantity");
catalogue.quantity.value = "";
catalogue.quantity.focus();
return (false);
}
if (catalogue.customername.value == "") {
alert("Please Enter Your Name");
catalogue.customername.focus();
return (false);
}
if (catalogue.address.value == ""){
alert("Please Enter Your Postal Address");
catalogue.address.focus();
return (false);
}
if (catalogue.suburb.value == ""){
alert("Please Enter Suburb Name");
catalogue.suburb.focus();
return (false);
}
if (catalogue.state.value == ""){
alert("Please Enter State Name");
catalogue.state.focus();
return (false);
}
if (catalogue.postcode.value == ""){
alert("Please Enter Postcode");
catalogue.postcode.focus();
return (false);
}
if (catalogue.email.value == "") {
alert("Please Enter the Email Address");
catalogue.email.focus();
return (false);
}
var rs = /(.*)@(.*).(.*)/;
if(!rs.test(catalogue.email.value))
{
alert("Please Enter a true Email Address");
catalogue.email.focus();
return false;
}
if (catalogue.phone.value == "") {
alert("Please Enter the Phone Number");
catalogue.phone.focus();
return (false);
}
if(!checkPhoneFax("phone",catalogue.phone.value)){
catalogue.phone.focus();
return false;
}
if (catalogue.fax.value == "") {
alert("Please Enter the Fax Number");
catalogue.fax.focus();
return (false);
}
if(!checkPhoneFax("fax",catalogue.fax.value)){
catalogue.fax.focus();
return false;
}
return true;}function checkPhoneFax(name,value) {
if ( (value.length != 8) || (!isNaN("value")) || (value.length !=8) || (!isNaN("value"))) {
alert("The " + name + " is not a valid number. Please try again.");
return false;
}
else{
return true;
}
}function processOrder() {
var check1 , check2 , check3;
check1 = check2 = check3 = false;
//check1 = updatePrice();
//check2 = checkRange(document.catalogue.quantity.name, document.catalogue.quantity.value,10,100);
check3 = checkField();
if (!check3) {
//alert("Your order cannot be submitted until you complete all required fields");
return false;
}
else {
alert("Your order has been processed succesfully");
return true;
}
}
//-->
</script>
</head>