Jump to content

chained select box


girlzz

Recommended Posts

hello sir..

 

i had some problem... i want to make 3 chained selected box but right now i had done just 2 chained select box.. how i want to do another chained box??

 

<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript">

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	
}



</script>

 

 <tr>
	<td width="131" height="24"><span class="style36">Year</span>: </td>
	<td width="360"><select name="dhtmlgoodies_country" id="dhtmlgoodies_country" onChange="getCityList(this)">
		<option value="">Select a year</option>
	  <option value="3">3</option>
	  <option value="4">4</option>
	  <option value="5">5</option>
	</select>	  </td>
</tr>
            <tr>
	<td height="24"><span class="style36">Block</span>: </td>
	<td><select name="dhtmlgoodies_city" id="dhtmlgoodies_city">

	</select>		</td>
</tr>
      <tr>
            <td class="style28" >Subject Code:</td>
            <td class="style28" ><select name="s_code" id="s_code">
              <option value="-">-</option>
              <option value="MED 3111">MED 3111</option>
              <option value="MED 3211">MED 3211</option>
              <option value="MED 3311">MED 3311</option>
              <option value="MED 3411">MED 3411</option>
              <option value="MED 3411">MED 3411</option>
              <option value="MED 4112">MED 4112</option>
              <option value="MED 4212">MED 4212</option>
              <option value="MED 4402">MED 4402</option>
              <option value="MED 4502">MED 4502</option>
              <option value="MED 4602">MED 4602</option>
              <option value="MED 4702">MED 4702</option>
              <option value="MED 5108">MED 5108</option>
              <option value="MED 5208">MED 5208</option>
              <option value="MED 5308">MED 5308</option>
              <option value="MED 5408">MED 5408</option>
              <option value="MED 5508">MED 5508</option>
            </select></td>

 

i had make block is choose from year but i doesn't know how to create select box where subject code is filter from year and block....

 

Link to comment
https://forums.phpfreaks.com/topic/123387-chained-select-box/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.