在页面刷新时保留单选按钮选择 [英] Retain Radio Button selection on page refresh

查看:102
本文介绍了在页面刷新时保留单选按钮选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个包含2个选项的下拉列表。从下拉列表中选择第一个选项我显示一个DIV,它有两个类别供用户回答。这些是要选择的单选按钮。

但是从下拉列表中选择第二个选项后,DIV区域被隐藏。

再次,我从下拉列表中选择第一个选项。

这样做我从选择默认值时单选按钮中丢失了用户选择的值。如何将其保留给用户选择?我正在使用已检查属性。

仍然无效。

以下是代码段。





Hi,
I have a a dropdown list with 2 options. Selecting first option from dropdown I display a DIV which has two categories for user to answer.These are radio buttons to be selected.
However after selecting second option from the drop down list,the DIV area is hidden.
Again I select the first option from the drop down list.
Doing this I am losing the user selected values from radio buttons as they get selected to default. How can I retain them to user selected? I am using the "checked" attribute.
Still doesn't work.
Following is the code snippet.


<TABLE id="Mytable"><TBODY>
<TR>
<TD>
<INPUT type=radio id="firstone" name="first" onclick="" VALUE="1" <%=("1".equals(Mytable)?"CHECKED":"")%>></TD>
<INPUT type=radio id="secondone" name="second" onclick="" VALUE="2" <%=("2".equals(Mytable)?"CHECKED":"")%>></TD>
</TR>
</TBODY>
</TABLE>

推荐答案

这篇关于在页面刷新时保留单选按钮选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆