开发者

how to reset the html dropdown list value to its orignal value when mouse move to next option

actually my problem is...

i using dropdown list in my jsp page. this dropdown list will have in a for loop.

example....

<% 
   int count1=0;
   for(int i=0;i<5;i++) {
   count1++;
%>

<div><input class="no" type="radio" name="companycode" id="<%=count1%>" value ="<%=count1%>"><%=count1%>
     <select class="none" name="cgccode" id="cgccode<%=count1%>">
     <option value="">-select-</option>
     <option value="google">GOOGLE</option>
     <option value="ibm">IBM</option>
     <option value="oracle">ORACLE</option>
     <option value="infosys">INFOSYS</option>
    </select></div>
<%
    } 
 %>

so, now my problem is,

suppose now i am selecting first radio button, and then i have select the first dropdown list value to IBM. but after that, i am selecting second radio button (without submitting the previous dropdown list value). and i am selecting to second dropdown value.

but here the first dropdown list does not comes to its previous state. and the selected data is looking as same.

so, i need to change it to its previous state. when i am moving to another radio button.

pls help. i need the solution code. i have tried 开发者_如何学编程many ways but its not possible.


Obviously, it won't work unless you use some JavaScript to reset the previous one.


Since everything you do in your scenario is done at client side, in the browser, without any communication to the server, you need to use JavaScript to detect when a radio button value is changed, and set back the other drop-down selections to their default value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜