Problem with the divs,can any body help me ,its urgent please..


C

chandoo

When the client not entered the input the div alert is visible and
after filling the input the div content is hidden,but i didn't get it ?
help me

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<title>The Cuban Club :: New Year's Day 2008</title>
<link rel="stylesheet" type="text/css" href="styles/default.css">
<META name="description" content="Lloyd Events invites you to
PerthÕs 2007 New Years Day alternative Ð The Cuban Club at the Oyster
Bar on the Beach, North Fremantle.">

<script type="text/javascript">
function isValidCreditCard(type, ccnum) {
//alert("hai");
//alert(type);
if (type == "Visa") {
// Visa: length 16, prefix 4, dashes optional.
var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
} else if (type == "MasterCard") {
// Mastercard: length 16, prefix 51-55, dashes optional.
var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
} else if (type == "Amex") {
// American Express: length 15, prefix 34 or 37.
var re = /^3[4,7]\d{13}$/;
} else if (type == "Diners") {
// Diners: le
ngth 14, prefix 30, 36, or 38.
var re = /^3[0,6,8]\d{12}$/;
}


if (!re.test(ccnum))
{
//alert("Invalid credit card number");
return false;
}
// Remove all dashes for the checksum checks to eliminate negative
numbers
ccnum = ccnum.split("-").join("");
// Checksum ("Mod 10")
// Add even digits in even length strings or odd digits in odd
length strings.
var checksum = 0;
for (var i=(2-(ccnum.length % 2)); i<=ccnum.length; i+=2) {
checksum += parseInt(ccnum.charAt(i-1));
}
// Analyze odd digits in even length strings or even digits in odd
length strings.
for (var i=(ccnum.length % 2) + 1; i<ccnum.length; i+=2) {
var digit = parseInt(ccnum.charAt(i-1)) * 2;
if (digit < 10) { checksum += digit; } else { checksum +=
(digit-9); }
}
if ((checksum % 10) == 0)
{
alert("Success");
return true;
}
else
{
alert("Credit card number not valid");
return false;
}
return true;
}
function echeck(email)
{
//alert(email);
var at=email.indexOf('@');
var dot=email.lastIndexOf('.');
var atpos=email.lastIndexOf('@');
var emlen=email.length;
if (at<1||dot-at<2||atpos+1==emlen||dot+1==emlen||emlen-dot<3)
{
alert("Invalid email address");;
return false;
}
return true;
}
function nvalid(name)
{
var spChars="`[email protected]#$%^&*()+='/\|{}[]?:;";
for(var i=0;i<name.length;i++)
{
if(spChars.indexOf(name.charAt(i))!=-1)
{
//alert(name+'special characters not allowed');
return false;
}
}
return true;
}
function Formvalid()
{
var sel=document.getElementById("cctype");
var res=sel.options[sel.selectedIndex].text;
//div code
var divTags = document.getElementsByTagName("div");
for (var i = 0; i < divTags.length ; i++)
{
//alert("hi");
divTags.style.visibility = 'hidden';
}

if(document.getElementById("Ticket").value=="select")
{
document.getElementById('enterticket').style.visibility ='visible';
document.getElementById("Ticket").focus();
return false;
}
if(document.form1.First_name.value=="")
{
alert('hfsd');
document.getElementById('enterfname').style.visibility ='visible';
document.form1.First_name.focus();
return false;
}
if(!nvalid(document.form1.First_name.value))
{
document.getElementById('fname').style.visibility ='visible';
document.form1.First_name.value="";
document.form1.First_name.focus();
return false;
}
if(document.form1.Address.value=="")
{
document.getElementById('enteraddress').style.visibility ='visible';
document.form1.Address.focus();
return false;
}
if(document.form1.Suburb.value=="")
{
document.getElementById('entersuburb').style.visibility ='visible';
document.form1.Suburb.focus();
return false;
}
if(document.form1.State.value=="")
{
document.getElementById('enterstate').style.visibility ='visible';
document.form1.State.focus();
return false;
}
if(document.form1.Postcode.value=="")
{
document.getElementById('enterpostcode').style.visibility
='visible';
document.form1.Postcode.focus();
return false;
}
else if(document.form1.Postcode.value!="")
{
if(isNaN(document.form1.Postcode.value))
{
document.getElementById('numpost').style.visibility ='visible';
document.form1.Postcode.value="";
document.form1.Postcode.focus();
return false;
}
}
if(document.form1.Mobilenumber.value=="")
{
document.getElementById('entermobile').style.visibility ='visible';
document.form1.Mobilenumber.focus();
return false;
}
else if(document.form1.Mobilenumber.value!="")
{
if(isNaN(document.form1.Mobilenumber.value))
{
document.getElementById('nummobile').style.visibility ='visible';
document.form1.Mobilenumber.value="";
document.form1.Mobilenumber.focus();
return false;
}
}
if(document.form1.Email.value=="")
{
document.getElementById('enteremail').style.visibility ='visible';
document.form1.Email.focus();
return false;
}
if(!echeck(document.form1.Email.value))
{
document.form1.Email.value="";
document.form1.Email.focus();
return false;
}//
if(document.form1.Cardholdername.value=="")
{
//alert('hfsd');
document.getElementById('entercardholder').style.visibility
='visible';
document.form1.Cardholdername.focus();
return false;
}
if(!nvalid(document.form1.Cardholdername.value))
{
document.getElementById('holdername').style.visibility ='visible';
document.form1.Cardholdername.value="";
document.form1.Cardholdername.focus();
return false;
}
if(document.form1.Cardtype.value=="Select")
{
//alert('hfsd');
document.getElementById('entercardtype').style.visibility
='visible';
document.form1.Cardtype.focus();
return false;
}
if(document.form1.Cardnumber.value=='')
{
document.getElementById('entercardnum').style.visibility
='visible';
document.form1.Cardnumber.focus();
return false;
}

else if(document.form1.Cardnumber.value!='')
{
if(!isValidCreditCard(res,document.form1.Cardnumber.value))
{
document.getElementById('checkcardnum').style.visibility
='visible';
document.form1.Cardnumber.value='';
document.form1.Cardnumber.focus();
return false;
}
}//
if(document.getElementById("edm").value=="select")
{
document.getElementById('expmonth').style.visibility ='visible';
document.getElementById("edm").focus();
return false;
}
if(document.getElementById("edy").value=="select")
{
document.getElementById('expyear').style.visibility ='visible';
document.getElementById("edy").focus();
return false;
}
return true;
}
</script>
</head>
<body id="home">
<div id="header">

<div id="wrapper"> <a href="index.html"><img src="images/logo.gif"
width="75" height="99" border="0" alt="logo"></a>
<p>
Lloyd Events<br>
t: 0401863120<br>
e: michael [AT] lloydevents.com<br>
</p>
<br clear="all">
</div>
</div>

<div id="container"> <img src="images/CUban header2008.jpg"
width="923" height="206" border="0" alt="">
<img src="images/photos.jpg" width="923" height="132" border="0"
alt="">
<div id="payment">
<table width="60%" border="0" align="center" cellpadding="5"
cellspacing="1" class="tbcontent">
<form name="form1" onSubmit="return Formvalid()" >
<tr>
<td colspan="2" align="left" class="tbheading">:: Order your
New Year ticket(s)</td>
</tr>
<tr>
<td colspan="2" align="left">Personal Information </td>
</tr>

<tr>

<td align="right">Ticket(s)*</td>
<td align="left"><select name="Ticket" id="Ticket"
class="listbox">
<option value="select">Select an option</option>
<option value="0.01">For 1 Person</option>
<option value="0.01">For 2 Persons</option>
<option value="0.01">For 3 Persons</option>
<option value="0.01">For 4 Persons</option>
<option value="0.01">For 5 Persons</option>
<option value="0.01">For 6 Persons</option>
<option value="0.01">For 7 Persons</option>
<option value="0.01">For 8 Persons</option>
<option value="0.01">For 9 Persons</option>
<option value="0.01">For 10 Persons</option>
</select>
<div id="enterticket" class="divs" style="visibility:hidden">Select
number of Tickets </div>
</td>
</tr>
<tr>
<td align="right">First Name*</td>
<td align="left"><input name="First_name" type="text"
class="textbox">
<div id="enterfname" class="divs" style="visibility:hidden">Enter
your First name </div>
<div id="fname" class="divs" style="visibility:hidden">Special
characters not allowed </div>
</td>
</tr>
<tr>
<td align="right">Last Name </td>
<td align="left"><input name="textfield2" type="text"
class="textbox"></td>
</tr>
<tr>
<td align="right">Address*</td>
<td align="left"><label>
<textarea name="Address" cols="30" rows="4"
class="textbox"></textarea>
</label>
<div id="enteraddress" class="divs" style="visibility:hidden">Enter
your address </div>

</td>
</tr>
<tr>
<td align="right">Suburb*</td>
<td align="left"><input name="Suburb" type="text"
class="textbox">
<div id="entersuburb" class="divs" style="visibility:hidden">Enter
Suburb </div>
</td>
</tr>
<tr>
<td align="right">State*</td>
<td align="left"><input name="State" type="text"
class="textbox">
<div id="enterstate" class="divs" style="visibility:hidden">Enter
State </div>
</td>
</tr>
<tr>
<td align="right">Post code*</td>
<td align="left"><input name="Postcode" type="text"
class="textbox">
<div id="enterpostcode" class="divs">Enter postcode </div>
<div id="numpost" class="divs" style="visibility:hidden">Enter
numbers only </div>
</td>
</tr>
<tr>
<td align="right">Home number </td>
<td align="left"><input name="textfield6" type="text"
class="textbox"></td>
</tr>
<tr>
<td align="right">Mobile number* </td>
<td align="left"><input name="Mobilenumber" type="text"
class="textbox">
<div id="entermobile" class="divs" style="visibility:hidden">Enter
MObile number </div>
<div id="nummobile" class="divs" style="visibility:hidden">Enter
MObile number </div>
</td>
</tr>
<tr>
<td align="right">Personal Email*</td>
<td align="left"><input name="Email" type="text"
class="textbox">
<div id="enteremail" class="divs">Enter email address </div>
<div id="evalid" class="divs">Invalid email address </div>
</td>
</td>
</tr>
<tr>
<td align="right">Work / Alternate Email </td>
<td align="left"><input name="textfield3" type="text"
class="textbox"></td>
</tr>
<tr>
<td colspan="2" align="right">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="left">Credit card Information </td>
</tr>
<tr>
<td align="right">Credit Card Holder Name*</td>
<td align="left"><input name="Cardholdername" type="text"
class="textbox">
<div id="entercardholder" class="divs"
style="visibility:hidden">Enter Credit Card Holder Name </div>
<div id="holdername" class="divs" style="visibility:hidden">Special
charcters not allowed </div>
</td>
</tr>
<tr>
<td align="right">Credit Card Type*</td>
<td align="left"><select name="Cardtype" id="cctype"
class="listbox">
<option value="Select">Cardtype</option>
<option>Amex</option>
<option>Visa</option>
<option>MasterCard</option>
<option>Diners</option>
</select>
<div id="entercardtype" class="divs"
style="visibility:hidden">Select Credit Card Type </div>
</td>
</tr>
<tr>
<td align="right">Credit Card Number*</td>
<td align="left"><input name="Cardnumber" type="text"
class="textbox" maxlength="16">
<div id="entercardnum" class="divs" style="visibility:hidden">Enter
Credit Card Number </div>
<div id="checkcardnum" class="divs"
style="visibility:hidden">Invalid Credit Card Number </div>

</td>
</tr>
<tr>
<td align="right">Expiry Date (mm/yy)*</td>
<td align="left">
<select name="Expirymonth" id="edm" class="listbox">
<option value="select">Expiry Month</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
&nbsp;
/
&nbsp;
<select name="Expiryyear" id="edy" class="listbox">
<option value="select">Expiry Year</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
</select>
<div id="expmonth" class="divs" style="visibility:hidden">Enter
expire month </div>
<div id="expyear" class="divs" style="visibility:hidden">Enter
expire year </div>

</td>
</tr>
<tr>
<td align="right">Comments</td>
<td align="left"><textarea name="textarea2"></textarea></td>
</tr>
<tr>
<td align="right">&nbsp;</td>
<td align="left">
<input name="Submit" type="submit" class="butons" value="Submit">
<input name="Clear" type="reset" class="butons" value="Clear"> </
td>
</tr>
</form>
</table>
</div>
<br clear="all">

<div id="footer">
<table cellpadding="10" cellspacing="0" border="0">
<tr>
<td><a href="http://www.onthebeach.net.au"
target="_blank"><img src="images/meads_logo.gif" width="180"
height="39" border="0"></a></td>
<td><a href="http://www.unicampforkids.org.au"
target="_blank"><img src="images/ucfk_logo.gif" width="180"
height="68" border="0"></a></td>

<td><a href="http://www.alexissadler.com" target="_blank"><img
src="images/lex.gif" width="74" height="74" border="0"></a></td>
</tr>
</table>



</div>
</div>
</body>
</html>
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top