Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

menu items gone when back button pressed

Status
Not open for further replies.

vasox56

Technical User
May 8, 2007
75
GB
hi.. my website is coming along nicely thanks to your guys help..

ive created a drop down system that now links to my database..

if you goto my page.. and in the first drop down choose 'London Postcode'

then choose any postcode from the list..

the choose FROM heathrow.. and click go..

a blank page comes up with a few details..

if you hit the back button.. the first drop down says London Postcodes still but the choices arent there...

its a minor thing but it is annoying me and i want to fix it..

here is the page.. try for yourself
http://www.londonheathrowcars.com/pindex.htm

the page code is below (minus the long array of postcodes)

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>London Heathrow Cars | Airport Transfer Service | Private Hire Minicab</title>

<link rel="stylesheet" type="text/css" href="22style.css" media="all" />
<script type="text/javascript">




  // an array to hold the contents of all lists
  var DataArray = new Array();

DataArray[0] = new Array("C1","search...", "");
DataArray[1] = new Array("C1","Central London", "");
the array...




  // swap contents of second list
  function switchList(List1)
  { var i, k;
    var List2 = document.getElementById("SecondList");
    var TypeOfValues = List1.options[List1.selectedIndex].value;

    //Remove all items in SecondList listbox
    //Start removing items at end and work back to front
    k = List2.options.length - 1;
    for (i = k; i >= 0; i--)
    { List2.options[i] = null;
    }

    k = 0;
     for(i = 0; i < DataArray.length; i++)
    { if (DataArray[i][0] == TypeOfValues)
      { List2.options[k] = new Option(DataArray[i][1], DataArray[i][2]);  
        if (DataArray[i][1] == "Central London") {
           List2.options[k].className = "difmarg";
        }  
		if (DataArray[i][1] == "West London") {
           List2.options[k].className = "difmarg";
        }   


if (DataArray[i][1] == "South West London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "North London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "North West London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "East London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "South East London") {
           List2.options[k].className = "difmarg";
        } 

if (DataArray[i][1] == "Greater London") {
           List2.options[k].className = "difmarg";
        }   
        k++;
      }
    }
	}
</script>
</head>

<body>
<div id="wrap" class="clearfix">

<div id="top"><img class="logo" src="xxlogo.jpg" alt="London Heathrow Cars Header" /></div>

    <div id="bleft">
<br />
<table border="0" width="225" id="table1" cellspacing="0" cellpadding="0">
	
		<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		
<iframe src="[URL unfurl="true"]http://free.timeanddate.com/clock/ih10p52/n136/tluk/fs12/fc666/ahl/avt/ftb/tt0/td1/ts1/tb4"[/URL] frameborder="0" width="186" height="32"></iframe>

		</td>
	</tr>

		<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		
		</td>
	</tr>
	<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		
<p class="big"><b>Quick Quote</b><br /></p>
<p style="color:#666666;font-family:arial;font-size:9pt;margin-top:5px;width:185px;">If your destination is not listed please click <u>here</u>.</p>
		</td>
	</tr>
	
		<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">

		</td>
	</tr>
<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		


		</td>
	</tr>


	<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		<form name="myform" method="post" action="1-direct.asp">
<select id="FirstList" name="FirstList" style="width:185px;margin-bottom:7px;background-color: #EBEBEB; font-family:arial; font-size: 12px; color: black;" onChange="switchList(this);">
    <option value="">Please Select..</option>
    
	<option value="C1">London Postcodes</option>
    <option value="C2">Greater London</option>
    </select>

		</td>
	</tr>


		<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
  <select id="SecondList" name="SecondList" style="background-color: #EBEBEB; font-family:arial; font-size: 12px; color: black;width:185px;">
  </select>

</td>
	</tr>
<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">




</td>
	</tr>

<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		<table border="0" width="205" id="table3" cellspacing="0" cellpadding="0">
			<tr>
				<td width="15">	

				<p class="tofrom"><input style="margin-left:0px;" type="radio" VALUE="V1" name="way" /></p></td>
				<td width="90"><p class="tofrom"><b>FROM</b> Heathrow</p></td>
				<td width="90" rowspan="2">
				<input style="margin-left:15px;background-color:#666666;font-weight:bold;font-size:12px;font-family:arial;color:white;width:55px;height:30px;" value="GO >>" name="B1" type="submit"></td>
			</tr>
			<tr>
				<td width="15">	
				<p class="tofrom"><input style="margin-left:0px;" type="radio" VALUE="V2" name="way" /></p></td>
				<td width="90"><p class="tofrom"><b>TO</b> Heathrow</p></td>
				
			</tr>
		</table>
</td>
	</tr>

<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">


</form>


</td>
	</tr>
<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">

</td>
	</tr>

<tr>
		<td width="20">&nbsp;</td>
		<td width="85">
<script language="javascript" src="[URL unfurl="true"]http://zazachat.zazasoftware.com/LiveChatClient/scripts/zazamagic.aspx?zimg=289&zazac=1686&iv=&iwidth=85&iheight=44"></script>[/URL]		</td>
		<td>
		<p class="main">Click for Live Help or leave a message.</p></td>
	</tr>
<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">



		</td>
	</tr>

<tr>
		<td width="20">&nbsp;</td>
		<td width="80">
		<img src="pco.gif" alt="PCO Taxi logo" />



		</td>
		<td>
		<p class="main">Private Hire Operator.<br />PCO License No: <b>03766</b></p></td>
	</tr>
	<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">



		</td>
	</tr>


	<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		<img src="baa.gif" alt="Heathrow Airport Logo" />
		</td>
	</tr>

	<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
		


		</td>
	</tr>

	<tr>
		<td width="20">&nbsp;</td>
		<td width="205" colspan="2">
<script type="text/javascript" charset="UTF-8" src="tinc?key=nqmvfCFG"></script>		</td>
	</tr>
</table>
<br /><br />
</div>

	    <div id="bright">
		        my content
</div>



</div>
</body>
</html>
 
i forgot to close the code tag and i should have removed the unneccesary coding..

here is a better version of my question..

choose London Postcode
choose any Postcode from the second list
choose from Heathrow radio
click Go
on next page hit back button on browser
postcodes have gone from drop down..

Code:
<script type="text/javascript">




  // an array to hold the contents of all lists
  var DataArray = new Array();

DataArray[0] = new Array("C1","search...", "");
DataArray[1] = new Array("C1","Central London", "");
the array...




  // swap contents of second list
  function switchList(List1)
  { var i, k;
    var List2 = document.getElementById("SecondList");
    var TypeOfValues = List1.options[List1.selectedIndex].value;

    //Remove all items in SecondList listbox
    //Start removing items at end and work back to front
    k = List2.options.length - 1;
    for (i = k; i >= 0; i--)
    { List2.options[i] = null;
    }

    k = 0;
     for(i = 0; i < DataArray.length; i++)
    { if (DataArray[i][0] == TypeOfValues)
      { List2.options[k] = new Option(DataArray[i][1], DataArray[i][2]);  
        if (DataArray[i][1] == "Central London") {
           List2.options[k].className = "difmarg";
        }  
        if (DataArray[i][1] == "West London") {
           List2.options[k].className = "difmarg";
        }   


if (DataArray[i][1] == "South West London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "North London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "North West London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "East London") {
           List2.options[k].className = "difmarg";
        }  

if (DataArray[i][1] == "South East London") {
           List2.options[k].className = "difmarg";
        }

if (DataArray[i][1] == "Greater London") {
           List2.options[k].className = "difmarg";
        }   
        k++;
      }
    }
    }
</script>

<form name="myform" method="post" action="1-direct.asp">
<select id="FirstList" name="FirstList" style="width:185px;margin-bottom:7px;background-color: #EBEBEB; font-family:arial; font-size: 12px; color: black;" onChange="switchList(this);">
    <option value="">Please Select..</option>
    
    <option value="C1">London Postcodes</option>
    <option value="C2">Greater London</option>
    </select>

        </td>
    </tr>


        <tr>
        <td width="20">&nbsp;</td>
        <td width="205" colspan="2">
  <select id="SecondList" name="SecondList" style="background-color: #EBEBEB; font-family:arial; font-size: 12px; color: black;width:185px;">
  </select>

</td>
    </tr>
<tr>
        <td width="20">&nbsp;</td>
        <td width="205" colspan="2">




</td>
    </tr>

<tr>
        <td width="20">&nbsp;</td>
        <td width="205" colspan="2">
        <table border="0" width="205" id="table3" cellspacing="0" cellpadding="0">
            <tr>
                <td width="15">    

                <p class="tofrom"><input style="margin-left:0px;" type="radio" VALUE="V1" name="way" /></p></td>
                <td width="90"><p class="tofrom"><b>FROM</b> Heathrow</p></td>
                <td width="90" rowspan="2">
                <input style="margin-left:15px;background-color:#666666;font-weight:bold;font-size:12px;font-family:arial;color:white;width:55px;height:30px;" value="GO >>" name="B1" type="submit"></td>
            </tr>
            <tr>
                <td width="15">    
                <p class="tofrom"><input style="margin-left:0px;" type="radio" VALUE="V2" name="way" /></p></td>
                <td width="90"><p class="tofrom"><b>TO</b> Heathrow</p></td>
                
            </tr>
        </table>
</td>
    </tr>

<tr>
        <td width="20">&nbsp;</td>
        <td width="205" colspan="2">


</form>
 
Hi

vasox56 said:
if you hit the back button.. the first drop down says London Postcodes still but the choices arent there...
Do you mean "aren't there in Explorer" ? You know, more detail, faster answer.

I would do it in two steps :
[ul]
[li]save the choice in a cookie before "GO >>"[/li]
[li]retrieve the cookie and load the list again in an [tt]onload[/tt] event handler"[/li]
[/ul]
This will solve the second scenario too.

Feherke.
 
im using firefox and they arent there aswell actually..

im not too good with cookies.. i suppose ill have to look into it then.

thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top