<input type=radio name=a1 checked>111111111
<input type=radio name=a1>111111111
<input type=radio name=a1>111111111
<input type=radio name=a1>111111111
<input type=radio name=a1>111111111
<input type=radio name=a1>111111111
<input type=radio name=a1>111111111
我想要的效果为:
<input type=radio name=a1>111111111
<input type=radio name=a2>111111111
<input type=radio name=a3>111111111
<input type=radio name=a4>111111111在这几项中任意选择一项,比方说a3 ,页面刷新后,a3 仍显示被选中的状态
如果选a4 ,页面刷新后,a4仍显示被选中的状态
dim arrv,i
arrv = split(request.form("h1"),",")
%><script language="javascript">
<!--
function fncsubmit()
{
var h = '';
var o = document.getElementsByTagName('INPUT');
for(var i=0;i<o.length;i++)
{
if(o[i].type == 'radio')
{
h += o[i].checked + ',';
}
}
h = h.substr(0,h.length-1);
document.all.h1.value = h;
form1.submit();
}
//-->
</script><form name=form1 method=post action=a.asp>
<input type=radio name=a1 <% if arrv(0)="true" then response.write "checked" %>>111111111
<input type=radio name=a2 <% if arrv(1)="true" then response.write "checked" %>>111111111
<input type=radio name=a3 <% if arrv(2)="true" then response.write "checked" %>>111111111
<input type=radio name=a4 <% if arrv(3)="true" then response.write "checked" %>>111111111
<p><input type=button value=submit onclick="fncsubmit();"></p>
<input type=hidden name=h1>
dim arrv,i
if request.form("h1") <> "" then
arrv = split(request.form("h1"),",")
end if
%><script language="javascript">
<!--
function fncsubmit()
{
var h = '';
var o = document.getElementsByTagName('INPUT');
for(var i=0;i<o.length;i++)
{
if(o[i].type == 'radio')
{
h += o[i].checked + ',';
}
}
h = h.substr(0,h.length-1);
document.all.h1.value = h;
form1.submit();
}
//-->
</script><form name=form1 method=post action=a.asp>
<input type=radio name=a1
<% if request.form("h1") <> "" then
if arrv(0)="true" then response.write "checked"
end if %>
>111111111
<input type=radio name=a2
<% if request.form("h1") <> "" then
if arrv(1)="true" then response.write "checked"
end if %>
>111111111
<input type=radio name=a3
<% if request.form("h1") <> "" then
if arrv(2)="true" then response.write "checked"
end if %>
>111111111
<input type=radio name=a4
<% if request.form("h1") <> "" then
if arrv(3)="true" then response.write "checked"
end if %>
>111111111
<p><input type=button value=submit onclick="fncsubmit();"></p>
<input type=hidden name=h1>
<body>
<form name=s1 method=post action=a.asp>
<input type=radio name=a1 value=1 onclick="s1.submit()">111111111
<input type=radio name=a1 value=2 onclick="s1.submit()">222222222
<input type=radio name=a1 value=3 onclick="s1.submit()">333333333
<input type=radio name=a1 value=4 onclick="s1.submit()">444444444
</form>
<script>
var c="<%=request.form("a1")%>";
if (c=="1") {document.s1.a1[0].checked=true;}
if (c=="2") {document.s1.a1[1].checked=true;}
if (c=="3") {document.s1.a1[2].checked=true;}
if (c=="4") {document.s1.a1[3].checked=true;}
</script>
建议还是使用asp或其他语言的相关方法进行较方便