Mir ist noch ne dritte Möglichkeit eingefallen, bei der nicht
alles neu geladen werden muss: iframes (ab IE3, NN6).
getElementById() funzt allerdings "erst" ab IE5.)
PHP-Code:
<script language="javascript"><!--
function jump(was, sel)
{
document.getElementById(was).location.replace(
was+ '.php?wo='+ sel.options[sel.selectedIndex].value
);
}
//--></script>
<form name="destination" ...>
<select name="land" onChange="jump('orte', this);">
...
</select>
<input type="hidden" name="ort" value="">
<input type="hidden" name="location" value="">
</form>
<iframe id="orte" src="orte.php?wo=0" width="120" height="100">
mist ... keine iFrames</iframe>
<iframe id="locations" src="locations.php?wo=0" width="120" height="100"></iframe>
...
</form>
orte.php: sucht die Orte, die im Land mit der id=$_GET['wo'] zu finden sind und fügt sie hier im Select als options ein:
PHP-Code:
<script language="javascript"><!--
function ortjump(sel)
{
// Auswahl in hidden input kopieren und Location-Frame neu laden
parent.forms['destination'].elements['ort'].value =
sel.options[sel.selectedIndex].value;
parent.document.jump('locations', sel);
}
//--></script>
<form ...>
<select name="orte" onChange="ortjump(this);">
...
</select>
</form>
locations.php: sucht alle Locations aus der Stadt mit id=$_GET['wo'] und fügt sie hier ein:
PHP-Code:
<script language="javascript"><!--
function locjump(sel)
{
// Auswahl in hidden input kopieren
parent.forms['destination'].elements['location'].value =
sel.options[sel.selectedIndex].value;
}
//--></script>
<form ...>
<select name="orte" onChange="locjump(this);">
...
</select>
</form>