...

View Full Version : A little help with this script



olidenia
10-14-2010, 12:21 PM
Can someone help me or point me in the right direction to enable browser back button on this script:


var ajax = new Array();

function getCityList(sel)
{
var countryCode = sel.options[sel.selectedIndex].value;
document.getElementById('dhtmlgoodies_city').options.length = 0; // Empty city select box
if(countryCode.length>0){
var index = ajax.length;
ajax[index] = new sack();

ajax[index].requestFile = 'getCities.php?countryCode='+countryCode; // Specifying which file to get
ajax[index].onCompletion = function(){ createCities(index) }; // Specify function that will be executed after file has been found
ajax[index].runAJAX(); // Execute AJAX function
}
}

function createCities(index)
{
var obj = document.getElementById('dhtmlgoodies_city');
eval(ajax[index].response); // Executing the response from Ajax as Javascript code
}

function getSubCategoryList(sel)
{
var category = sel.options[sel.selectedIndex].value;
document.getElementById('dhtmlgoodies_subcategory').options.length = 0; // Empty city select box
if(category.length>0){
var index = ajax.length;
ajax[index] = new sack();

ajax[index].requestFile = 'getSubCategories.php?category='+category; // Specifying which file to get
ajax[index].onPageload = function(){ createSubCategories(index) }; // Specify function that will be executed after file has been found
ajax[index].runAJAX(); // Execute AJAX function
}
}
function createSubCategories(index)
{
var obj = document.getElementById('dhtmlgoodies_subcategory');
eval(ajax[index].response); // Executing the response from Ajax as Javascript code
}


PHP page:

<p>
Area
<select name="province" onchange="getCityList(this)">
<option value="">Select Area</option>
<option value="1"> Area 1</option>
<option value="2"> Area 2</option>
<option value="3"> Area 3</option>
<option value="4"> Area 4</option>
<option value="5"> Area 5</option>
<option value="6"> Area 6</option>
<option value="7"> Area 7</option>
<option value="8"> Area 8</option>
</select>
</p>

<!-- Populate city town from area dropdown -->
<p>
City/Town<select value="" id="dhtmlgoodies_city" name="town"></select>
</p>

hdewantara
10-15-2010, 12:39 PM
Use cookies?

Zefris
10-16-2010, 02:23 AM
http://code.google.com/p/reallysimplehistory/

That perhaps? ;o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum