Click to See Complete Forum and Search --> : jumpage function not working


pat1968
01-27-2003, 12:13 PM
can anyone make this work? the select one menu with another fuction works fine but the jumpPage function keeps bouncing me back to the original page. i have only put one sub category aray in for brevity! any help would be much appreciated many thanks pat












<SCRIPT language=JavaScript>

<!--

var adclassValue = new Array("", "B", "A", "F", "H", "L", "M", "N", "C", "P", "R", "J", "T");

var adclassText = new Array("CATEGORY", "Business", "Drive", "Family", "Home", "Leisure", "Music", "Notices", "Compu-Ads", "Personal", "Property", "Sits Vac", "Travel");

var ValueA = new Array("", "A01 Agricultural Vehicles", "A02 Bicycle Accessories", "A03 Bicycles", "A04 Breaking & Salvage", "A05 Car Sales under $1000", "A06 Cars - Accessories & Spares", "A07 Collectors Cars", "A08 Commercial Access./Spares", "A09 Commercial Vehicle Sales", "A10 Garage Equipment", "A11 Garages to Sale/Rent/Build", "A12 Helmets, Boots & Clothing", "A13 In Car Hi-Fi", "A14 Scooters, Spares & Accs", "A15 Motorcycle Spares & Accs", "A16 Motorcycles", "A17 Registration Plates", "A18 Salvage, Breaking, Recovery", "A19 Motorcross & Trial Bikes", "A20 Security & Alarms", "A21 Hire & Leasing", "A22 Auto Finance & Insurance", "A23 Trailers", "A24 Vintage Motorcycles", "A25 Wheels & Tyres", "A26 Workshop Manuals", "A27 Share Drive", "houstonfreeadds/non_autos_advert_form.php?A28 Cars Sales A-Z", "A29 Car Valeting", "A30 Motorcycle Servicing/Repair", "A31 Servicing, MOTs & Repairs", "A32 Driving Instruction", "A33 Plant Machinery for Sale/Hire", "A34 Aircraft","A35 Aircraft-Spares&Acces");

var TextA = new Array("All", "Agricultural Vehicles", "Bicycle Accessories", "Bicycles", "Breaking & Salvage", "Car Sales under $1000", "Cars - Accessories & Spares", "Collectors Cars", "Commercial Access./Spares", "Commercial Vehicle Sales", "Garage Equipment", "Garages to Sale/Rent/Build.", "Helmets, Boots & Clothing", "In Car Hi-Fi", "Scooters, Spares & Accs", "Motorcycle Spares & Accs.", "Motorcycles", "Registration Plates.", "Salvage, Breaking, Recovery", "Motorcross & Trial Bikes", "Security & Alarms", "Hire & Leasing", "Auto Finance & Insurance.", "Trailers", "Vintage Motorcycles", "Wheels & Tyres", "Workshop Manuals", "Share Drive", "Cars Sales A-Z", "Car Valeting", "Motorcycle Servicing/Repair", "Servicing, MOTs & Repairs", "Driving Instruction", "Plant Machinery for Sale/Hire","Aircraft","Aircraft-Spares&Acces");












function resetOptions(){

the_select=window.document.searchdetails.AdClass;

the_select.options.length = adclassValue.length;

for (i=0; i < adclassValue.length; i++){

the_select.options[i].text = adclassText[i];

the_select.options[i].value = adclassValue[i];

}

the_select.selectedIndex = 0;

the_select=window.document.searchdetails.category;

the_select.options.length = 1;

the_select.options[0].text = "SUB-CATEGORY";

the_select.options[0].value = "";

the_select.selectedIndex = 0;

}

function swapOptions(the_array_name){

if (the_array_name == ""){

resetOptions();

return;

}

// Set the variables to hold the section text and value array names

var adclassValueArray = eval("Value" + the_array_name);

var adclassTextArray = eval("Text" + the_array_name);

the_select=window.document.searchdetails.category;

// set the number of selectable options to the number of products

the_select.options.length = adclassValueArray.length;

for (i=0; i < adclassValueArray.length; i++){

the_select.options[i].text = adclassTextArray[i];

the_select.options[i].value = adclassValueArray[i];

}

}

// -->

</SCRIPT>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Hide script from old browsers





function jumpPage(newLoc) {



/*if value passed is "" ie a category title do nothing*/
if(myform.newLocation.value == ""){
var $submission_cat="";
}
else {
/* if the value passed is the autos search no need for search.php*/
if(myform.newLocation.value == "category=A28 Cars Sales A-Z") {
var $submission_cat="autos_advert_form.php?";
}

else {
/* if it's not autos or category title we need to go to search.php*/
if(myform.newLocation.value != "category=A28 Cars Sales A-Z") {
var $submission_cat="non_autos_advert_form.php?";
}

}
}

newPage =$submission_cat+newLoc.options[newLoc.selectedIndex].value


if (newPage !="") {

window.location = newPage
}
}
// End hiding script from old browsers -->





</SCRIPT>
</head>








<FORM name=searchdetails method=get>
If you want to browse through the advertsk on a section below
and then select a category from the list.
<select onChange=swapOptions(this.options[this.selectedIndex].value);
name=AdClass>
<option value="" selected>CATEGORY</option>
<option>Business</option>
<option>Autos</option>
<option>Family</option>
<option>Home</option>
<option>Leisure</option>
<option>Music</option>
<option>Notices</option>
<option>Compu-Ads</option>
<option>Personal</option>
<option>Property</option>
<option>Sits Vac</option>
<option>Travel</option>
</select>
Category<BR>
<select name="category" onsubmit="jumpPage(this.form.category)">
<option value="" selected>SUB-CATEGORY</option>
<option value="">All</option>
</select>
<input name="submit" type=submit value=submit>
</form>

</BODY></HTML>