数据库绑定做好了  这是我的一个新ASP代码  现在我想当点一个单选按钮时候(有很多个单选按钮组),就把它的值传递到一个div中,要一行行的显示出来,并且有个提交按钮来提交内容。
        真心感谢
<%@ Language=VBScript %> 
<%
if session("pass")<> 1 then
response.redirect "login.asp"
else 
end if
set rs=server.createobject("adodb.recordset")
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("exercise.mdb")'初始化数据库
sql="select * from test"
rs.open sql,conn,3,3
do while not rs.eof 
RANDOMIZE
RandomValue = INT(17*RND)+1
rs("count")=rs("count")+RandomValue
rs.update
rs.movenext
loop
rs.closesql="select top 5 * from test order by count desc"
Set rs = conn.Execute(sql)
%><head>
<style type="text/css">
<!--
.unnamed1 {  font-size: 10pt; text-decoration: none}
-->
</style>
<script> 
function GetValue() 

    var Key = GetRadioValue("ans<%=i%>");
    var str = Key+"<br/>"
     if(document.getElementById("N1").checked)
    {
        str = str + CheckV   
    }
    document.getElementById("Content").innerHTML = str;   
}function GetRadioValue(RadioName){
        var obj;    
        obj=document.getElementsByName(RadioName);
        if(obj!=null){
            var i;
            for(i=0;i<obj.length;i++){
                if(obj[i].checked){
                    return obj[i].value;            
                }
            }
        }
        return null;
}
</script> 
<FORM action="mailto:[email protected]?subject=锐明视讯" id=FORM1 method=post name=FORM1 enctype="text/plain">
<div id="Content" style="border:1px solid #000000;height:100px; width:100px;"></div> 
  <P align="center"> 
    <%
  i=1
  rs.movefirst
  do while not rs.eof%> 
  <P align="center">&nbsp;&nbsp; <%=rs("question")%> </P>
  <div align="center"> 
    <TABLE align=center border=1 cellPadding=1 cellSpacing=1 width="35%" bordercolor="#0099FF">
      <TR bgcolor="#99CCFF"> 
        <TD style="WIDTH: 70%" width="49%"> 
          <INPUT name=ans<%=i%>  type=radio value="A">
          <%=rs("A")%> </TD>
      </TR>
      <TR bgcolor="#CCCCFF"> 
        <TD width="49%"> 
          <input name=ans<%=i%>
 type=radio value="B">
          <%=rs("B")%> </TD>
      </TR>
      <TR bgcolor="#99CCFF"> 
        <td width="51%">
          <input name=ans<%=i%>  
type=radio value="C">
          <%=rs("C")%> </td>
      </TR>
      <TR bgcolor="#CCCCFF"> 
        <TD width="49%"> 
          <input name=ans<%=i%>  
type=radio value="D" >
          <%=rs("D")%> </TD>
      </TR>
    </TABLE>
    <%
i=i+1
rs.movenext
loop
%> 
    </div>
  <div align="center">
    </P>
  </div>
  <P align="center">&nbsp;</P>
  <P align=center> 
    <INPUT id=submit1 name=submit1 type=submit value="提交">
    <INPUT id=reset1 name=reset1 type=reset value="重填">
    </P>
</FORM>

解决方案 »

  1.   

    就是把一个选中的单选按钮的值显示到一个div中去
      

  2.   

     <input name=ans <%=i%>  
    type=radio value="<%=rs("C")%>" onclick="javascript:Show(this);"><script>
    function Show(obj)
    {
      document.getElementById("Content").innerHTML=obj.value;
    }
    </script> 
      

  3.   

    大哥我这有五个单选按钮组   怎么只能显示选中的一个值传递到了div中   其它的也要显示到里面
    好像要循环???
      

  4.   


    现在我想当点一个单选按钮时候(有很多个单选按钮组),就把它的值传递到一个div中,要一行行的显示出来,并且有个提交按钮来提交内容。 你不是说只显示选中的一个值么??
      

  5.   

    把他们选择的都显示到div中去  麻烦你了
      

  6.   

    <input name=ans <%=i%>  
    type=radio value=" <%=rs("C")%>" onclick="javascript:Show(this);"> <script> 
    function Show(obj) 

      document.getElementById("Content").innerHTML=document.getElementById("Content").innerHTML + "<br />" + obj.value; 

    </script> 
      

  7.   

    我错了    还有个小问题   就是那个按钮组只要一个值显示就可以,我有五个按钮组  就像是选择题那样
       这是我的数据库 每个按钮组有4个答案  只要一个答案 共五个   以后我还加题目的
    question A B C D ans count
    操作系统 操作系统1 操作系统2 操作系统3 操作系统4 A 3666
    内存条 内存条1 内存条2 内存条3 内存条4 B 3637
    硬盘 硬盘1 硬盘2 硬盘3 硬盘4 C 3748
    X3DVR X3DVR1 X3DVR4 X3DVR6 X3DVR8 B 3897
    X2DVR X2DVR1 X2DVR2 X2DVR4 X2DVR5 B 3273
    X4DVR X6DVR1 X6DVR2 X6DVR3 X6DVR0 A 3380
    加速 加速1 加速2 加速3 加速4 4 3494
      

  8.   

    那你隐含的逻辑是不是这个按钮组的有没有被选过?如果选过了就是替换一下,如果没有选过,就增加一列??大哥你问问题的时候表达清楚一点,我这里挤牙膏一样浪费我的时间也浪费你的时间你要不先google 提问的智慧, 想清楚了再问一下...这种问题都没多难....
      

  9.   

    <input name=ans <%=i%>  
    type=radio value=" <%=rs("C")%>" onclick="javascript:Show(this,<%=i%>);"><script>
    var hash=new Array();
    function Show(obj,pos) 
    {   
    document.getElementById("Content").innerHTML="";  
      hash[pos]=obj.value;
      for(var n in hash)
       {
    document.getElementById("Content").innerHTML+=hash[n]+"<br />";  
       }  } 
    </script>