Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Div wont hide

  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Div wont hide

    HI


    Having problems getting this Div to hid, anyone able to help?

    javascript



    Code:
    function dateDiff() {
    
    t1 = document.date.firstDate.value;
    t2 = document.date.secondDate.value;
    
    var one_day=1000*60*60*24; 
    var x=t1.split("/"); 
    var y=t2.split("/");
    //date format(Fullyear,month,date) 
    var date1=new Date(x[2],(x[1]-1),x[0]);
    var date2=new Date(y[2],(y[1]-1),y[0])
    var month1=x[1]-1;
    var month2=y[1]-1;
    var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day)); 
    
    var time1 = parseInt(document.getElementById('time1').value, 10);
    var time2 = parseInt(document.getElementById('time2').value, 10);
    if(time2-time1 >= 5) {Diff = Diff +1};
    if (Diff == 0)	{Diff = 1};
    if (Diff < 0)	{Diff = 0};
    
    
    
    document.date.days.value = (Diff +" days");
    
    if ( Diff >= 50 )
    
    	{ document.getElementById('waive').style.display='none'}
    	
    	else 
    	
    	{ document.getElementById('waive').style.display=''}
    }
    html
    Code:
    <div id="waive">
    <tr>
    <td height="25" align="right"><span class="c2">Excess Waiver (Reduce Excess to £100) added?</span></td>
    <td colspan="3"   height="25" width="20"><select name="waiv"  id="waiv" onchange="waivon() ;deposit()">
    <option value="y">Yes</option>
    <option value="n" selected="selected">No</option>
    </select>
    </td></tr>
    
    
    <tr>
    <td height="25" align="right"><span class="c2">Excess Waiver Cost:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="ewc" name="ewc" readonly="readonly" /></td></tr></div>

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    487
    Thanks
    0
    Thanked 54 Times in 53 Posts
    It's not really valid/proper to mix <div> and <tr> tags. The <div> tag should be a child of a <td> or outside of the <table> completely. This might have to do with why it's not working. However, you'll need to post some more of your code for us to be able to help. Your script is referencing document.date.firstDate.value and document.date.secondDate.value which elements you've not included in the HTML portion. Also there is no call to the dateDiff() function so we don't know how/when you are calling it to hide the #waive div.

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts
    thank you for your help, here is full 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" xml:lang="en" lang="en">
    <head>
    <meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Online Booking- Penny Car Hire</title>
    <meta name="keywords" content="self drive van hire, uk, car hire, surrey, berkshire, staines, windsor, addlestone, egham, self drive, cars, vans, mpv, people carrier, rental, hire, monthly deals, reservations, local, pick-up, drop-off, points" />
    <meta name="description" content="Surrey and Berkshire based company offering self drive van hire and cheap car hire, from hatchbacks to Transit vans." />
    <link rel="stylesheet" href="layout-ff.css" type="text/css" media="screen, projection" />
    <link rel="stylesheet" href="style.css" type="text/css" media="screen, projection" />
    <script type="text/javascript" src="price2.js" charset="utf-8">
    //<![CDATA[
    
    //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
    //Script featured on JavaScript Kit (http://www.javascriptkit.com.
    //For this script, visit http://www.javascriptkit.com
    
    //]]>
    </script>
    <script type="text/javascript">
    //<![CDATA[
    <!--
    
    
    function newcust(){
    
    if(document.date.hireb4.options[document.date.hireb4.selectedIndex].value=="")
    {alert("Please Select New Or Returning Customer");}
    
    return false;
    }
    //-->
    //]]>
    </script>
    <style type="text/css">
    /*<![CDATA[*/
     div.c7 {height:180px;}
     table.c6 {background-color: #CCCCCC; margin: 2px auto}
     div.c5 {margin-left: 2em; text-align: center}
     input.c4 {text-align:center;font-weight:bold;color:#000000}
     img.c3 {cursor:pointer}
     span.c2 {font-size: 80%}
     input.c1 {display: none;}
    /*]]>*/</style>
    </head>
    <body onload="loading(), yolla()">
    <div id="container"><!-- header ................................. -->
    <div id="header">
    <h2><a href="index.html"><img src="images/pchsmall.gif" alt="** PLEASE DESCRIBE THIS IMAGE **" /><img src="images/pennylogo.jpg" alt="** PLEASE DESCRIBE THIS IMAGE **" /><span class="Apple-tab-span" style="white-space: pre">					</span></a>Tel: 01344 843050</h2></div><!-- /header --><!-- navigation ................................. -->
    <div id="navigation"></div><!-- /navigation --><br />
    <!-- content ................................. -->
    <div class="entry single" id="pcontent">
    <form id="date" name="date" method="get" action="javascript:action">
    <table class="c6" border="5" width="600" cellspacing="4">
    <tbody>
    <tr>
    <td>
    <table align="center" border="0" width="470" cellspacing="0" cellpadding="2">
    <tbody>
    <br />
    <div id="bilgi"></div>
    <br />
    <tr>
    <tr>
    <td align="center" height="25" colspan="4" width="470"><span><strong>Please Enter Details For A Quote.</strong></span></td></tr>
    <tr>
    <td align="right">Select Vehicle:</td>
    <td colspan="3" height="25" width="220"><select name="car" id="car" onchange="dateDiff() ;calculate() ;incmile() ;deposit() ;milecharge() ;agecheck() ;waivon() ">
    <option value="B2" selected="">Manual Picanto 1.25 </option>
    <option value="CD">Manual Rio 1.5 </option>
    <option value="CD2">Manual Corsa 1.4 </option>
    <option value="CD3">Auto Picanto 1.25 </option>
    <option value="E">Manual Venga 1.4 </option>
    <option value="E2">Auto Rio 1.4 </option>
    <option value="F2">Auto Cee'd 1.6</option>
    <option value="F5">Auto Venga 1.6</option>
    <option value="G">Auto Cee'd Estate 1.6 </option>
    <option value="G2">Manual Sportage 1.6 2WD </option>
    <option value="I">Manual Sportage 1.7 2WD </option>
    <option value="J">Auto Sportage 2.0 4X4 </option>
    <option value="L">Auto Sorento 4X4 7 Seater</option>
    <option value="L2">Auto i800 8 Seater</option>
    <option value="L3">Auto Carens 7 Seater</option>
    <option value="N">Manual NV200 Van</option>
    <option value="O">Manual LWB LL29 Trafic</option></select>
    <button type="button" onclick="info()">More Info</button></td></tr><!--=======end drop down box====-->
    <tr>
    <td height="25" align="right"><span class="c2">Collect Date:</span></td>
    <td height="24" width="230"><input id="firstDate" type="text" readonly="readonly" class="c4 size=" 25"="" onchange="dateDiff() ;calculate() ;suncheck() ;satcheck() ;deposit() ;incmile() ;milecharge() ;box2();tody() ;waivon()" /><img src="images/cal.gif" onclick="javascript:NewCssCal ('firstDate','ddMMyyyy','','','','','future')" class="c3" alt="** PLEASE DESCRIBE THIS IMAGE **" /></td><!--======new time box====================-->
    <td height="25" align="right"><span class="c2">Time:</span></td>
    <td align="right" width="97"><span class="c2"><select name="time1" id="time1" onchange="dateDiff() ;calculate() ;suncheck() ;incmile() ;satcheck() ;deposit() ;milecharge() ;waivon()">
    <option value="1">08:00 AM</option>
    <option value="2">08:30 AM</option>
    <option value="3">09:00 AM</option>
    <option value="4">09:30 AM</option>
    <option value="5">10:00 AM</option>
    <option value="6">10:30 AM</option>
    <option value="7">11:00 AM</option>
    <option value="8">11:30 AM</option>
    <option value="9" selected="selected">12:00 PM</option>
    <option value="10">12:30 PM</option>
    <option value="11">01:00 PM</option>
    <option value="12">01:30 PM</option>
    <option value="13">02:00 PM</option>
    <option value="14">02:30 PM</option>
    <option value="15">03:00 PM</option>
    <option value="16">03:30 PM</option>
    <option value="17">04:00 PM</option>
    <option value="18">04:30 PM</option>
    <option value="19">05:00 PM</option>
    <option value="20">05:30 PM</option>
    <option value="21">06:00 PM</option>
    <option value="22">06:30 PM</option>
    <option value="23">07:00 PM</option>
    <option value="24">07:30 PM</option></select></span></td><!--========end time box================================--></tr>
    <tr>
    <td height="21" align="right"><span class="c2">Return Date:</span></td>
    <td height="23" width="220"><input id="secondDate" type="text" size="25" class="c4 readonly=" readonly"="" onchange="dateDiff() ;calculate() ;satcheck2() ;deposit() ;suncheck2() ;milecharge() ;incmile() ;box2() ;waivon()" /><img src="images/cal.gif" onclick="javascript:NewCssCal ('secondDate','ddMMyyyy','','','','','future')" class="c3" alt="** PLEASE DESCRIBE THIS IMAGE **" /></td><!--======new time box====================-->
    <td height="25" align="right"><span class="c2">Time:</span></td>
    <td align="right" width="97"><span class="c2"><select name="time2" id="time2" onchange="dateDiff() ;calculate() ;dateDiff() ;suncheck2() ;incmile() ;satcheck2() ;deposit() ;milecharge() ;waivon()">
    <option value="1">08:00 AM</option>
    <option value="2">08:30 AM</option>
    <option value="3">09:00 AM</option>
    <option value="4">09:30 AM</option>
    <option value="5">10:00 AM</option>
    <option value="6">10:30 AM</option>
    <option value="7">11:00 AM</option>
    <option value="8">11:30 AM</option>
    <option value="9" selected="selected">12:00 PM</option>
    <option value="10">12:30 PM</option>
    <option value="11">01:00 PM</option>
    <option value="12">01:30 PM</option>
    <option value="13">02:00 PM</option>
    <option value="14">02:30 PM</option>
    <option value="15">03:00 PM</option>
    <option value="16">03:30 PM</option>
    <option value="17">04:00 PM</option>
    <option value="18">04:30 PM</option>
    <option value="19">05:00 PM</option>
    <option value="20">05:30 PM</option>
    <option value="21">06:00 PM</option>
    <option value="22">06:30 PM</option>
    <option value="23">07:00 PM</option>
    <option value="24">07:30 PM</option></select></span></td><!--========end time box================================--></tr>
    <tr>
    <td align="right" height="15"><span class="c2">Rental Period:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" onchange="satcheck()" class="c4" name="days" readonly="readonly"  /> </td></tr>
    <tr>
    <td height="25" align="right"><span class="c2">Inclusive Price:</span></td>
    <td colspan="0" height="25" width="220"><input type="text" class="c4" name="rentalamount" readonly="readonly" /> </td></tr>
    
    <tr>
    <td height="25" align="right"><span class="c2">Deposit:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="depo" name="depo" readonly="readonly" /></td></tr>
    <div id="aive">
    <tr>
    <td height="25" align="right"><span class="c2">Excess Waiver (Reduce Excess to £100) added?</span></td>
    <td colspan="3"   height="25" width="20"><select name="waiv"  id="waiv" onchange="waivon() ;deposit()">
    <option value="y">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
    <option value="n" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
    </select>
    </td></tr>
    
    
    <tr>
    <td height="25" align="right"><span class="c2">Excess Waiver Cost:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="ewc" name="ewc" readonly="readonly" /></td></tr></div>
    
    
    <tr>
    <td height="25" align="right"><span class="c2"><b>Total Rental Cost:</b></span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="trc" name="trc" readonly="readonly" /> </td></tr>
    <div id="fourweek">
    <tr>
    <td height="25" align="right"><span class="c2">Payable 4 weekly in advance at a rate of :</span></td>
    <td colspan="3" height="25" width="220"><input type="text"  class="c4" id="price4" name="price4" readonly="readonly"  /> </td></tr>
    </div>
    
    
    
    
    <tr>
    <td height="25" align="right"><span class="c2">Mileage Allowance:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="alow" name="alow" readonly="readonly" /></td></tr>
    
    
    
    
    <tr>
    <td height="25" align="right"><span class="c2">Excess Mileage:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" name="mile" readonly="readonly" /></td></tr>
    <tr>
    <td colspan="6" height="25" width="220">
    <div class="c5"><strong>Opening times</strong><br />
    Monday - Friday: 8AM - 8PM<br />
    Saturday: 9AM - 6 PM<br />
    Sunday: 4PM - 8PM<br />
    
    Please Contact Us For Bank Holiday Weekend Opening Times<br />
    <br />
    Please Note The Prices Are For UK Only <br />
    
    If You Wish To Go Oversea's Please Call Us<br />
    <br />
    Call us on: 01344 843050<br />
    Please Check our <a href="conditions.html" title="">Terms and Conditions</a><br />
    
    
    <input type="hidden" class="c4" id="waiv2" name="waiv2" readonly="readonly" />
    <input type="hidden" class="c4" id="waivmo" name="waivmo" readonly="readonly" />
    
    
    Have You hired from us in the last 3 years: <select name="hireb4" id="hireb4" onchange="this.form.action=this.options[this.selectedIndex].value;">
    <option value="">Please Select:</option>
    <option value="bookingprev.html">Yes</option>
    <option value="booking.html">No</option></select><br />
    <button type="submit" onclick="newcust()" value="Submit">Booking Request</button></div><input type="text" id="lpag" class="c1" /><input type="text" class="c1" id="date1" name="date1" /><input type="text" class="c1" id="date2" name="date2" /></td></tr></tbody></table></td></tr></tbody></table></form></div><!-- /content --><!-- subcontent ................................. --><!-- footer ................................. -->
    <div id="footer">
    <p><strong>� 2006 - 2009 Penny Car Hire: <a href="">Self Drive Van Hire and Car Hire, Surrey and Berkshire</a>. All Rights Reserved.</strong></p><!-- /footer --></div>
    <div class="c7"></div><!-- Google Code for Price Quote Conversion Page --></div>
    </body>
    </html>

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    487
    Thanks
    0
    Thanked 54 Times in 53 Posts
    Do you have this up on a server or test server, somewhere we can see how it's not working? Otherwise, can you include all of the scripts? My gut still says it has something to do with the mixed <div> & <tr>. It would be better to id/class the <tr> and hide them, or break the table up into multiple tables and hide the appropriate one. Ideally it would be best to just disable the affected fields and maybe include an explanation as to why they've become disabled.

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    487
    Thanks
    0
    Thanked 54 Times in 53 Posts
    It was as I thought. You will need to either manipulate the <tr> tags or separate the tables so the waiver rows are in their own table. I've done it the first way (manipulating the table rows directly) here.
    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" xml:lang="en" lang="en">
    <head>
    <meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Online Booking- Penny Car Hire</title>
    <meta name="keywords" content="self drive van hire, uk, car hire, surrey, berkshire, staines, windsor, addlestone, egham, self drive, cars, vans, mpv, people carrier, rental, hire, monthly deals, reservations, local, pick-up, drop-off, points" />
    <meta name="description" content="Surrey and Berkshire based company offering self drive van hire and cheap car hire, from hatchbacks to Transit vans." />
    <link rel="stylesheet" href="layout-ff.css" type="text/css" media="screen, projection" />
    <link rel="stylesheet" href="style.css" type="text/css" media="screen, projection" />
    <script type="text/javascript" src="price2.js" charset="utf-8">
    //<![CDATA[
    
    //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
    //Script featured on JavaScript Kit (http://www.javascriptkit.com.
    //For this script, visit http://www.javascriptkit.com
    
    //]]>
    </script>
    <script type="text/javascript">
    //<![CDATA[
    <!--
    
    
    function newcust(){
    
    if(document.date.hireb4.options[document.date.hireb4.selectedIndex].value=="")
    {alert("Please Select New Or Returning Customer");}
    
    return false;
    }
    //-->
    //]]>
    </script>
    <script type="text/javascript">
    //<![CDATA[
    
    function dateDiff() {
    console.log("entered dateDiff()");
    t1 = document.date.firstDate.value;
    t2 = document.date.secondDate.value;
    
    var one_day=1000*60*60*24; 
    var x=t1.split("/"); 
    var y=t2.split("/");
    //date format(Fullyear,month,date) 
    var date1=new Date(x[2],(x[1]-1),x[0]);
    var date2=new Date(y[2],(y[1]-1),y[0])
    var month1=x[1]-1;
    var month2=y[1]-1;
    var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day)); 
    
    var time1 = parseInt(document.getElementById('time1').value, 10);
    var time2 = parseInt(document.getElementById('time2').value, 10);
    if(time2-time1 >= 5) {Diff = Diff +1};
    if (Diff == 0)	{Diff = 1};
    if (Diff < 0)	{Diff = 0};
    
    
    
    document.date.days.value = (Diff +" days");
    
    if ( Diff >= 50 )
    
    	{ document.getElementById('waive').style.display='none';
    	console.log(document.getElementById('waive'));
    	document.getElementById('waiveRow1').style.display='none';
    	document.getElementById('waiveRow2').style.display='none';
    	console.log(Diff + " " + (Diff >=50));
    	}
    	
    	else 
    	
    	{ document.getElementById('waive').style.display='';
    	console.log(document.getElementById('waive'));
    	document.getElementById('waiveRow1').style.display='';
    	document.getElementById('waiveRow2').style.display='';
    	console.log(Diff + " " + (Diff >=50));
    	}
    }
    
    function loading(){};
    function calculate(){};
    function yolla(){};
    function suncheck(){};
    function incmile(){};
    function satcheck(){};
    function deposit(){};
    function milecharge(){};
    function waivon(){};
    function suncheck2(){};
    function satcheck2(){};
    function agecheck(){};
    //]]>
    
    </script>
    
    <style type="text/css">
    /*<![CDATA[*/
     div.c7 {height:180px;}
     table.c6 {background-color: #CCCCCC; margin: 2px auto}
     div.c5 {margin-left: 2em; text-align: center}
     input.c4 {text-align:center;font-weight:bold;color:#000000}
     img.c3 {cursor:pointer}
     span.c2 {font-size: 80%}
     input.c1 {display: none;}
    /*]]>*/</style>
    </head>
    <body onload="loading(), yolla()">
    <div id="container"><!-- header ................................. -->
    <div id="header">
    <h2><a href="index.html"><img src="images/pchsmall.gif" alt="** PLEASE DESCRIBE THIS IMAGE **" /><img src="images/pennylogo.jpg" alt="** PLEASE DESCRIBE THIS IMAGE **" /><span class="Apple-tab-span" style="white-space: pre">					</span></a>Tel: 01344 843050</h2></div><!-- /header --><!-- navigation ................................. -->
    <div id="navigation"></div><!-- /navigation --><br />
    <!-- content ................................. -->
    <div class="entry single" id="pcontent">
    <form id="date" name="date" method="get" action="javascript:action">
    <table class="c6" border="5" width="600" cellspacing="4">
    <tbody>
    <tr>
    <td>
    <table align="center" border="0" width="470" cellspacing="0" cellpadding="2">
    <tbody>
    <!--<br />
    <div id="bilgi"></div>
    <br />-->
    <!--<tr>-->
    <tr>
    <td align="center" height="25" colspan="4" width="470"><span><strong>Please Enter Details For A Quote.</strong></span></td></tr>
    <tr>
    <td align="right">Select Vehicle:</td>
    <td colspan="3" height="25" width="220"><select name="car" id="car" onchange="dateDiff() ;calculate() ;incmile() ;deposit() ;milecharge() ;agecheck() ;waivon() ">
    <option value="B2" selected="selected">Manual Picanto 1.25 </option>
    <option value="CD">Manual Rio 1.5 </option>
    <option value="CD2">Manual Corsa 1.4 </option>
    <option value="CD3">Auto Picanto 1.25 </option>
    <option value="E">Manual Venga 1.4 </option>
    <option value="E2">Auto Rio 1.4 </option>
    <option value="F2">Auto Cee'd 1.6</option>
    <option value="F5">Auto Venga 1.6</option>
    <option value="G">Auto Cee'd Estate 1.6 </option>
    <option value="G2">Manual Sportage 1.6 2WD </option>
    <option value="I">Manual Sportage 1.7 2WD </option>
    <option value="J">Auto Sportage 2.0 4X4 </option>
    <option value="L">Auto Sorento 4X4 7 Seater</option>
    <option value="L2">Auto i800 8 Seater</option>
    <option value="L3">Auto Carens 7 Seater</option>
    <option value="N">Manual NV200 Van</option>
    <option value="O">Manual LWB LL29 Trafic</option></select>
    <button type="button" onclick="info()">More Info</button></td></tr><!--=======end drop down box====-->
    <tr>
    <td height="25" align="right"><span class="c2">Collect Date:</span></td>
    <td height="24" width="230"><input id="firstDate" type="text" class="c4" size="25" onchange="dateDiff() ;calculate() ;suncheck() ;satcheck() ;deposit() ;incmile() ;milecharge() ;box2();tody() ;waivon()" value="01/03/2014" /><img src="images/cal.gif" onclick="javascript:NewCssCal ('firstDate','ddMMyyyy','','','','','future')" class="c3" alt="** PLEASE DESCRIBE THIS IMAGE **" /></td><!--======new time box====================-->
    <td height="25" align="right"><span class="c2">Time:</span></td>
    <td align="right" width="97"><span class="c2"><select name="time1" id="time1" onchange="dateDiff() ;calculate() ;suncheck() ;incmile() ;satcheck() ;deposit() ;milecharge() ;waivon()">
    <option value="1">08:00 AM</option>
    <option value="2">08:30 AM</option>
    <option value="3">09:00 AM</option>
    <option value="4">09:30 AM</option>
    <option value="5">10:00 AM</option>
    <option value="6">10:30 AM</option>
    <option value="7">11:00 AM</option>
    <option value="8">11:30 AM</option>
    <option value="9" selected="selected">12:00 PM</option>
    <option value="10">12:30 PM</option>
    <option value="11">01:00 PM</option>
    <option value="12">01:30 PM</option>
    <option value="13">02:00 PM</option>
    <option value="14">02:30 PM</option>
    <option value="15">03:00 PM</option>
    <option value="16">03:30 PM</option>
    <option value="17">04:00 PM</option>
    <option value="18">04:30 PM</option>
    <option value="19">05:00 PM</option>
    <option value="20">05:30 PM</option>
    <option value="21">06:00 PM</option>
    <option value="22">06:30 PM</option>
    <option value="23">07:00 PM</option>
    <option value="24">07:30 PM</option></select></span></td><!--========end time box================================--></tr>
    <tr>
    <td height="21" align="right"><span class="c2">Return Date:</span></td>
    <td height="23" width="220"><input id="secondDate" type="text" size="25" class="c4" onchange="dateDiff() ;calculate() ;satcheck2() ;deposit() ;suncheck2() ;milecharge() ;incmile() ;box2() ;waivon()" value="01/05/2014" /><img src="images/cal.gif" onclick="javascript:NewCssCal ('secondDate','ddMMyyyy','','','','','future')" class="c3" alt="** PLEASE DESCRIBE THIS IMAGE **" /></td><!--======new time box====================-->
    <td height="25" align="right"><span class="c2">Time:</span></td>
    <td align="right" width="97"><span class="c2"><select name="time2" id="time2" onchange="dateDiff() ;calculate() ;dateDiff() ;suncheck2() ;incmile() ;satcheck2() ;deposit() ;milecharge() ;waivon()">
    <option value="1">08:00 AM</option>
    <option value="2">08:30 AM</option>
    <option value="3">09:00 AM</option>
    <option value="4">09:30 AM</option>
    <option value="5">10:00 AM</option>
    <option value="6">10:30 AM</option>
    <option value="7">11:00 AM</option>
    <option value="8">11:30 AM</option>
    <option value="9" selected="selected">12:00 PM</option>
    <option value="10">12:30 PM</option>
    <option value="11">01:00 PM</option>
    <option value="12">01:30 PM</option>
    <option value="13">02:00 PM</option>
    <option value="14">02:30 PM</option>
    <option value="15">03:00 PM</option>
    <option value="16">03:30 PM</option>
    <option value="17">04:00 PM</option>
    <option value="18">04:30 PM</option>
    <option value="19">05:00 PM</option>
    <option value="20">05:30 PM</option>
    <option value="21">06:00 PM</option>
    <option value="22">06:30 PM</option>
    <option value="23">07:00 PM</option>
    <option value="24">07:30 PM</option></select></span></td><!--========end time box================================--></tr>
    <tr>
    <td align="right" height="15"><span class="c2">Rental Period:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" onchange="satcheck()" class="c4" name="days" readonly="readonly"  /> </td></tr>
    <tr>
    <td height="25" align="right"><span class="c2">Inclusive Price:</span></td>
    <td colspan="0" height="25" width="220"><input type="text" class="c4" name="rentalamount" readonly="readonly" /> </td></tr>
    
    <tr>
    <td height="25" align="right"><span class="c2">Deposit:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="depo" name="depo" readonly="readonly" /></td></tr>
    <!--<div id="waive">-->
    <tr id="waiveRow1">
    <td height="25" align="right"><span class="c2">Excess Waiver (Reduce Excess to £100) added?</span></td>
    <td colspan="3"   height="25" width="20"><select name="waiv"  id="waiv" onchange="waivon() ;deposit()">
    <option value="y">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
    <option value="n" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
    </select>
    </td></tr>
    
    
    <tr id="waiveRow2">
    <td height="25" align="right"><span class="c2">Excess Waiver Cost:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="ewc" name="ewc" readonly="readonly" /></td></tr><!--</div>-->
    
    
    <tr>
    <td height="25" align="right"><span class="c2"><b>Total Rental Cost:</b></span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="trc" name="trc" readonly="readonly" /> </td></tr>
    <!--<div id="fourweek">-->
    <tr>
    <td height="25" align="right"><span class="c2">Payable 4 weekly in advance at a rate of :</span></td>
    <td colspan="3" height="25" width="220"><input type="text"  class="c4" id="price4" name="price4" readonly="readonly"  /> </td></tr>
    <!--</div>-->
    
    
    
    
    <tr>
    <td height="25" align="right"><span class="c2">Mileage Allowance:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="alow" name="alow" readonly="readonly" /></td></tr>
    
    
    
    
    <tr>
    <td height="25" align="right"><span class="c2">Excess Mileage:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" name="mile" readonly="readonly" /></td></tr>
    <tr>
    <td colspan="6" height="25" width="220">
    <div class="c5"><strong>Opening times</strong><br />
    Monday - Friday: 8AM - 8PM<br />
    Saturday: 9AM - 6 PM<br />
    Sunday: 4PM - 8PM<br />
    
    Please Contact Us For Bank Holiday Weekend Opening Times<br />
    <br />
    Please Note The Prices Are For UK Only <br />
    
    If You Wish To Go Oversea's Please Call Us<br />
    <br />
    Call us on: 01344 843050<br />
    Please Check our <a href="conditions.html" title="">Terms and Conditions</a><br />
    
    
    <input type="hidden" class="c4" id="waiv2" name="waiv2" readonly="readonly" />
    <input type="hidden" class="c4" id="waivmo" name="waivmo" readonly="readonly" />
    
    
    Have You hired from us in the last 3 years: <select name="hireb4" id="hireb4" onchange="this.form.action=this.options[this.selectedIndex].value;">
    <option value="">Please Select:</option>
    <option value="bookingprev.html">Yes</option>
    <option value="booking.html">No</option></select><br />
    <button type="submit" onclick="newcust()" value="Submit">Booking Request</button></div><input type="text" id="lpag" class="c1" /><input type="text" class="c1" id="date1" name="date1" /><input type="text" class="c1" id="date2" name="date2" /></td></tr></tbody></table></td></tr></tbody></table></form></div><!-- /content --><!-- subcontent ................................. --><!-- footer ................................. -->
    <div id="footer">
    <p><strong>&copy; 2006 - 2009 Penny Car Hire: <a href="">Self Drive Van Hire and Car Hire, Surrey and Berkshire</a>. All Rights Reserved.</strong></p><!-- /footer --></div>
    <div class="c7"></div><!-- Google Code for Price Quote Conversion Page --></div>
    </body>
    </html>
    Note: You will want to study this code thoroughly but you should not paste it in to your existing site. I fixed many HTML validation issues (mostly removing those <div> tags from around the <tr> tags) and changed the functionality of some of your scripts and form fields for testing purposes.

    Here are the important bits.
    Code:
    function dateDiff() {
    
    t1 = document.date.firstDate.value;
    t2 = document.date.secondDate.value;
    
    var one_day=1000*60*60*24; 
    var x=t1.split("/"); 
    var y=t2.split("/");
    //date format(Fullyear,month,date) 
    var date1=new Date(x[2],(x[1]-1),x[0]);
    var date2=new Date(y[2],(y[1]-1),y[0])
    var month1=x[1]-1;
    var month2=y[1]-1;
    var Diff=Math.ceil((date2.getTime()-date1.getTime())/(one_day)); 
    
    var time1 = parseInt(document.getElementById('time1').value, 10);
    var time2 = parseInt(document.getElementById('time2').value, 10);
    if(time2-time1 >= 5) {Diff = Diff +1};
    if (Diff == 0)	{Diff = 1};
    if (Diff < 0)	{Diff = 0};
    
    
    
    document.date.days.value = (Diff +" days");
    
    if ( Diff >= 50 )
    
    
    
    	{ //document.getElementById('waive').style.display='none';
    	document.getElementById('waiveRow1').style.display='none';
    	document.getElementById('waiveRow2').style.display='none';
    	}
    	
    	else 
    	
    	{ //document.getElementById('waive').style.display='';
    	document.getElementById('waiveRow1').style.display='';
    	document.getElementById('waiveRow2').style.display='';
    	}
    }
    And
    Code:
    <!--<div id="waive">-->
    <tr id="waiveRow1">
    <td height="25" align="right"><span class="c2">Excess Waiver (Reduce Excess to £100) added?</span></td>
    <td colspan="3"   height="25" width="20"><select name="waiv"  id="waiv" onchange="waivon() ;deposit()">
    <option value="y">Yes</option>
    <option value="n" selected="selected">No</option>
    </select>
    </td></tr>
    
    
    <tr id="waiveRow2">
    <td height="25" align="right"><span class="c2">Excess Waiver Cost:</span></td>
    <td colspan="3" height="25" width="220"><input type="text" class="c4" id="ewc" name="ewc" readonly="readonly" /></td></tr><!--</div>-->
    I've commented out the old script code and invalid HTML.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •