我要在ASP中加入一段javescript去选择页面上三种radio中的一种哪位大虾可以帮忙啊 ?小妹万分感谢!附上radio的定义:
<table border=0 width=100% cellspacing=0 cellpadding=0>
<tr>
<td width=20%>
<INPUT type="radio" value="A"
id="approval<%=i%>" name="approval<%=i%>">
</td>
<td width=80%><strong>
<FONT face=Arial color=#b55b79 size=1>
Approve </font></strong></td>
</tr>
<tr>
<td width=20%>
<INPUT type="radio" value="R"
id="approval<%=i%>" name="approval<%=i%>">
</td>
<td width=80%><strong>
<FONT face=Arial color=#b55b79 size=1>
Disapprove </font></strong></td>
</tr>
<tr>
<td width=20%>
<INPUT type="radio" value="T" checked
id="approval<%=i%>" name="approval<%=i%>">
</td>
<td width=80%><strong>
<FONT face=Arial color=#b55b79 size=1>
To be decided </font></strong></td>
</tr>
</table>

解决方案 »

  1.   

    <input type="radio" id="ra1" name="ra" value="1"/>1
    <input type="radio" id="ra2" name="ra" value="2"/>2
    <input type="radio" id="ra3" name="ra" value="3"/>3
    <script>
    document.getElementById("ra2").checked = true;
    </script>
      

  2.   

    <input type="radio" id="ra" name="ra" value="1"/>
    <input type="radio" id="ra" name="ra" value="2"/>
    <input type="radio" id="ra" name="ra" value="3"/>
    <script>
    var a=document.getElementsByName("ra");
    for(var i=0;i<a.length;i++)
    if(a[i].value=="2")a[i].checked="true";
    //var a=document.getElementsByName("approval<%=i%>">); //in asp
    //for(var i=0;i<a.length;i++)
    //if(a[i].value=="<%=??%>")a[i].checked="true";   //in asp
    </script>
      

  3.   

    Click the link to solve your problem.Good luck!