2012-01-04 51 views
0

我有4個單選按鈕和一個文本框和一個搜索按鈕。用戶選擇一個radiobtn,鍵入關鍵字並點擊搜索。 OnClick of按鈕,radiobutton值和inputbox值被抓取並作爲查詢字符串傳遞給URL。像這樣http://mysite.com/event.aspx?kwd=keyword&type=radiobtnvalue 如果用戶選擇事件,在'Dance'中輸入類型並點擊SearchButton,它將轉到http://mysite.com/event.aspx?kwd=Dance&type=Event並刷新頁面,一旦頁面刷新,它會將默認'checked'重置爲'All'。即使在刷新後,我也想保持用戶選中的收音機的選中狀態。可能嗎?使用某種形式的jQuery?
基本邏輯是這樣的,如果頁面URL是mysite.com/event.aspx,默認選中radioBtn是「所有」其他任何用戶選擇,並傳遞到URL查詢字符串作爲即使頁面刷新後仍然保留或設置已檢查的單選按鈕被檢查

<div class="EventRadios" style="color:#574319; font:13px Trebuchet"> 
    <input type="radio" name="EventType" value="" checked="checked"/>All &nbsp; 
    <input type="radio" name="EventType" value="Classes" />Class &nbsp; 
    <input type="radio" name="EventType" value="Events" />Event &nbsp;  
    <input type="radio" name="EventType" value="Support Groups" />Support Group&nbsp;&nbsp;<br /><br /> 
</div> 
<input name="KeywordBox" class="BasicSearchInputBox" type="text" value="Keyword Search..."/> 
<div class="searchBtnHolder"><a class="searchButton" href="#" type="submit"><span>Search</span></a></div> 

回答