我有4組下拉列表中的元素,他們應該互相結合,其對目的地。第一個應該有所有的目的地,然後根據用戶選擇的第二個下拉列表具有可用於所選城市的值(目的地),然後另外兩個下拉列表將具有與該目的地相反的路。它的東西就像這個網站上的表格: http://info.airprishtina.com/content/index.php?id=20&no_cache=1&L=0(你可以在左邊的例子中看到有一個bookig表單)。我需要ajax腳本來做到這一點。我會照顧PHP的任務。
<div class="WraperForForm">
<form action="index.php?menu=rezervimet&submenu=rezervo" method="post">
<table cellspacing="5" cellpadding="0" border="0" >
<tr>
<td width="100">
Emri:
</td>
<td width="190">
<input type="text" id="emri" name="emri">
</td>
<td width="100">
Mbiemri:
</td>
<td width="190">
<input type="text" id="mbiemri" name="mbiemri">
</td>
</tr>
</table>
<table width="300" cellspacing="5" cellpadding="0" border="0" style="float:left;">
<tr>
<td width="100">
Prej:
</td>
<td>
<select class="selectDest" name="Prej">
'.funksionet::directions(1).'
</select>
</td>
</tr>
<tr>
<td width="80">
Deri:
</td>
<td>
<select class="selectDest" name="Deri">
'.funksionet::directions(2).'
</select>
</td>
</tr>
<tr>
<td>
<form name="Data1Drejtim">
<label for="data1drejtim">Data e nisjes:</label>
</td>
<td>
<input type="text" id="data1drejtim" name="data1drejtim">
<script language="JavaScript">
// whole calendar template can be redefined per individual calendar
var A_CALTPL = {
\'months\' : [\'Janar\', \'Shkurt\', \'Mars\', \'Prill\', \'Maj\', \'Qershor\', \'Korrik\', \'Gusht\', \'Shtator\', \'Tetor\', \'Nentor\', \'Dhjetor\'],
\'weekdays\' : [\'Di\', \'He\', \'Ma\', \'Me\', \'Ej\', \'Pr\', \'Sh\'],
\'yearscroll\': true,
\'weekstart\': 0,
\'centyear\' : 70,
\'imgpath\' : \'images/\'
}
new tcal ({
// if referenced by ID then form name is not required
\'controlname\': \'data1drejtim\'
}, A_CALTPL);
</script>
</td>
</tr>
</table>
<!-- ___________________Return table_____________________________________ -->
<table width="300" cellspacing="5" cellpadding="0" border="0" style="float:left;" id="hideThis" >
<tr>
<td width="100">
Prej:
</td>
<td>
<select class="selectDest" name="KthyesePrej" >
'.funksionet::directions(2).'
</select>
</td>
</tr>
<tr>
<td width="40">
Deri:
</td>
<td>
<select class="selectDest" name="KthyeseDeri">
'.funksionet::directions(1).'
</select>
</td>
<tr>
<td>
<label for="dataKthyese">Data kthyese:</label>
</td>
<td>
<input type="text" id="dataKthyese" name="dataKthyese">
<script language="JavaScript">
// whole calendar template can be redefined per individual calendar
var A_CALTPL = {
\'months\' : [\'Janar\', \'Shkurt\', \'Mars\', \'Prill\', \'Maj\', \'Qershor\', \'Korrik\', \'Gusht\', \'Shtator\', \'Tetor\', \'Nentor\', \'Dhjetor\'],
\'weekdays\' : [\'Di\', \'He\', \'Ma\', \'Me\', \'Ej\', \'Pr\', \'Sh\'],
\'yearscroll\': true,
\'weekstart\': 0,
\'centyear\' : 70,
\'imgpath\' : \'images/\'
}
new tcal ({
// if referenced by ID then form name is not required
\'controlname\': \'dataKthyese\'
}, A_CALTPL);
</script>
</form>
</td>
</tr>
</table>
<table width="585" cellspacing="0" cellpadding="3" border="0 " style="float:left;">
<tr>
<td >Persona:</td>
<td>
<select>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
</tr>
<tr>
<td width="100">
<input type="radio" id="1drejtim" name="drejtimi" value="një drejtim" onclick="toggleVisibility(\'hideThis\',0)">
<label for="1drejtim">Një drejtim</label>
</td>
<td >
<input type="radio" id="kthyese" name="drejtimi" checked="checked" value="kthyese" onclick="toggleVisibility(\'hideThis\',1)">
<label for="1drejtim">Kthyese</label>
</td>
<td>
<input style="float:right;" type="submit" value="Rezervo" name="rezervo" />
</td>
</tr>
</table>
</form><!-- end of the reservation form-->
</div>
這是代碼的一部分,當我開始它,我忘了,人們將能夠從接近他們或從國外城市做預約,所以我做出了從下拉菜單隻能與國內一線城市和TO與外國城市的下拉列表。無論如何,我需要所有這一切與阿賈克斯,因爲我不善於與阿賈克斯!
謝謝你的時間。
我們可以看到迄今爲止您一直在處理的代碼嗎? –
你有沒有想過自己想辦法呢? –
@Ben埃弗拉我發現了一個腳本,使結果文本但那不是我需要什麼,我試圖讓它工作,但我不能,因爲我不擅長阿賈克斯在所有 腳本:http://roshanbh.com .np/2008/09 /轉換文本值,下拉列表的Ajax-php.html – TooCooL