我有一個HTML查看頁面。我有一個下拉框,從那裏我可以選擇兩個值中的任何一個:OPEN和CLOSE。從這個下拉框中選擇一個值後,我需要點擊一個搜索按鈕。根據我從下拉框中選擇的值,該點擊將指引我到另一個視圖頁面。我怎樣才能做到這一點?????單擊按鈕時加載頁面,從下拉框中選擇一個值
這裏是我的下拉框和按鈕:
<td>
<select id="myChoice" class="combo"style="width: 110px; height: 25px">
<option value="" class="combo">--Select--</option>
<option value="open">OPEN</option>
<option value="close">CLOSE</option>
</select></td>
<td>
<button type="button" style="width: 90px; height: 25px; font-size: 11px" onclick="$root.SearchCustomerProfile">Search</button>
</td>
這裏是我的JavaScript函數:
self.SearchCustomerProfile = function() {
var customer_case = document.getElementById('myChoice').value;
if ((customer_case) == "open" || (customer_case) == "close")
{
window.location.href = '/CustomerProfileSearch';
}
}
請發佈你到底做了什麼樣的樣品 –
然後把它縮小到一個簡單的例子,允許重現問題。併發布這個簡化的例子。 –
好的,我編輯了我的文章,幷包含最相關的代碼片段。希望你能從中理解。請注意,點擊搜索按鈕後,我想加載CustomerProfileSearch頁面。 –