| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 978 人关注过本帖
标题:请教:单选按钮问题!
只看楼主 加入收藏
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
你想要的是
--"如果我是一 一被选中"--
--"如果我是二 二被选中"--
--"如果我是三 三被选中"--
三个都显示;
但是你写的是
如果我是一 就显示 --"一被选中"--
如果我是二 就显示 --"二被选中"--
如果我是三 就显示 --"三被选中"--
只显示一个
如果你想继续写程序 最好能理清逻辑 如果理不清 很不适合再继续了 因为你只能问 而且只能问最终的代码 为什么我这里没有给你代码呢?
你不知道举一反三 因为我在#7已经很明白的给了你答案了
2009-07-13 17:37
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:7 
楼主整个页面代码怎么写的?写程序的确要有逻辑思维和举一反三的能力,而且做网站开发Javascript非常重要,这个不会的话某些时候就会很难办的。
2009-07-13 17:57
xuanwang
Rank: 1
等 级:新手上路
帖 子:117
专家分:0
注 册:2009-6-29
收藏
得分:0 
<!--#Include virtual="/info/gloab/global.asp"-->

<%  
    Set conn=server.CreateObject ("adodb.connection")
    conn.ConnectionString =F_strconnection
    conn.open
  
    if err.number<>0 then
        response.Write"数据库连接错误"
        conn.Close
    end if
    
    set rsStu_level = Server.CreateObject("ADODB.RecordSet")    
    strStu_level="select stu_level from stu_levellist"   '查询入学年级
    rsStu_level.Open strStu_level,conn,1,1

    set rsFwz = Server.CreateObject("ADODB.RecordSet")
    strFwz="select fdzID,fdzname from fdzlist"  '查询教学服务站
    rsFwz.Open strFwz,conn,1,1
 
    set rsStudyKind= Server.CreateObject("ADODB.RecordSet")
    strStudyKind="select * from studykindlist order by studykindid"  '查询层次
    rsStudyKind.Open strStudyKind,conn,1,1
  
    set rsSubject = Server.CreateObject("ADODB.RecordSet")
    strSubject="select * from subjectsys"   '查询专业
    rsSubject.Open strSubject,conn,1,1

    stu_level=request.Form("stu_level")
    fdzid=request.Form("fdzid")   
    studykindid=request.Form("studykindid")   
    subjectid=request.Form("subjectid")            
    studentname=request.Form("studentname")  
    cardid=request.Form("cardid")
    page=CInt(request.Form("page"))
    rdo=request.Form("rdo")
 %>
<html xmlns="http://www.
<head>
<title>报名信息查询</title>
<script type="text/javascript">
//级联
function cascade(x)
{
    var temp=document.form1.subjectid;
    var tStr="";
    var tAry;
    var cnt;   
    temp.options.length=0;
    for(var i=0;i<document.form1.Subject.length;i++)  
    {
        tStr=document.form1.Subject[i].value;  
        tAry=tStr.split('|');
        cnt=tAry[0];
        if(cnt==x)
           temp.options.add(new Option(tAry[1],tAry[2]));
    }
}
//下一页
function pageDown()
{
    document.form1.action="222.asp";
    document.form1.page.value=parseInt(document.form1.page.value)+1;   
    document.form1.submit();   
}
//最后一页
function pageEnd(PageNum)
{
    document.form1.action="222.asp";   
    document.form1.page.value=parseInt(PageNum);   
    document.form1.submit();   
}
//第一页
function pageHome()
{
    document.form1.action="222.asp";
    document.form1.page.value=parseInt(1);
    document.form1.submit();   
}
//上一页
function pageUp()
{
    document.form1.action="222.asp";
    document.form1.page.value=parseInt(document.form1.page.value)-1;
    document.form1.submit();   
}
function pageSubmit()
{
   document.form1.action="222.asp";
   document.form1.page.value=parseInt(1);
   document.form1.submit();   
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<div style="background:#99CCFF;text-align:center;">
<div style="text-align:center"><b>报名信息查询</b><p></p>
显示按:
   
    <input name="rdo" type="radio" checked="checked" value="层次"/>层次 &nbsp;&nbsp;
   
    <input name="rdo" type="radio" value="专业号" />专业号 &nbsp; &nbsp;
   
    <input name="rdo" type="radio" value="档案号" />档案号
   
    &nbsp; &nbsp; &nbsp;排序<br />
    <br />

</div>
    <table style="width: 766px; height: 63px" border="1" bordercolor="#808080" bordercolordark="#FFFFFF" bordercolorlight="#E1F5FF">
        <tr>
            <td style="width: 265px; height: 34px;">
                入学年级:
                <select name="stu_level" style="width: 158px; height: 21px;">
                    <option value="">请 选 择</option>
                     <%                 
                        do while not rsStu_level.eof
                     %>
                     <% if  rsStu_level("stu_level")=stu_level then %>
                             <option selected value="<%=rsStu_level("stu_level") %>"><%=rsStu_level("stu_level") %></option>
                     <%else %>
                             <option  value="<%=rsStu_level("stu_level") %>"><%=rsStu_level("stu_level") %></option>              
                     <%end if %>
                     <%     rsStu_level.movenext
                        loop                 
                     %>            
                </select>
              </td>
            <td style="width: 305px; height: 34px;">
                教学服务站:
                <select name="fdzid" style="width: 200px; height: 21px;">
                    <option value="">全 部</option>
                     <%               
                        do while not rsFwz.eof
                     %>
                     <%if rsFwz("fdzid")=fdzid then %>
                             <option selected value="<%=rsFwz("fdzid") %>"><%=rsFwz("fdzname") %></option>
                     <%else %>
                             <option value="<%=rsFwz("fdzid") %>"><%=rsFwz("fdzname") %></option>
                     <%end if %>
                     <%   rsFwz.movenext                           
                        loop
                     %>   
                </select>               
             </td>
        </tr>
        <tr>
            <td style="width: 265px; height: 33px;">
                &nbsp;层 &nbsp;&nbsp; 次:<select name="studykindid" style="width: 162px; height: 21px;" onchange="cascade(this.options.value)">
                    <option value="">请 选 择</option>
                     <%         
                        do while not rsStudyKind.eof
                     %>
                     <%if rsStudyKind("StudyKindid")=studykindid then %>
                             <option selected value="<%=rsStudyKind("StudyKindid") %>"><%=rsStudyKind("StudyKind") %></option>  
                     <%else %>
                             <option value="<%=rsStudyKind("StudyKindid") %>"><%=rsStudyKind("StudyKind") %></option>
                     <%end if %>
                     <%   rsStudyKind.movenext                             
                        loop
                     %>   
                </select>
             </td>
            <td style="width: 305px; height: 33px;">
                &nbsp;专 &nbsp;  &nbsp;&nbsp; 业:<select name="subjectid" style="width: 198px; height: 10px;">
                    <option value="">全 部</option>
                    <%  
                        do until rsSubject.eof
                    %>
                    <%if rsSubject("Subjectid")=subjectid then %>
                            <option selected value="<%=rsSubject("Subjectid") %>"><%=rsSubject("Subject") %></option>
                    <%else %>
                            <option value="<%=rsSubject("Subjectid") %>"><%=rsSubject("Subject") %></option>
                    <%end if %>      
                    <%      
                        rsSubject.movenext
                        loop                       
                    %>  
                </select>
            </td>
                    <%
                        rsSubject.movefirst
                        do until rsSubject.eof
                           Response.write "<input type='hidden' name='Subject' value="&rsSubject("studykindid")&"|"&rsSubject("subject")&"|"&rsSubject("subjectid")&" >"&Chr(13)
                           rsSubject.MoveNext
                        Loop
                    %>   
        </tr>
    </table>            
    <br />
    或<br />
    <br />
    <table border="1" style="width: 764px; height: 28px" bordercolor="#808080" bordercolordark="#FFFFFF" bordercolorlight="#E1F5FF">
        <tr>
            <td style="width: 310px; height: 31px">
                姓&nbsp; 名:<input name="studentname" style="width: 223px; height: 22px;" type="text" /></td>
            <td style="width: 358px; height: 31px">
                证件号码:<input name="cardid" style="width: 269px; height: 22px;" type="text" /></td>
        </tr>
    </table>
    <br />
    <input name="btnQuery" type="button" value="查  询" style="width: 74px" onclick="pageSubmit()" />
    <br />
    <br />
    <table style="width: 859px; height: 11px" border="1" bordercolor="#808080" bordercolordark="#FFFFFF" bordercolorlight="#E1F5FF">
        <tr bgcolor="#E1F5FF">
            <td style="width: 154px; height: 8px" align="center">
                入学年级
            </td>
            <td style="width: 367px; height: 8px"  align="center">
                教学服务站
            </td>
            <td style="width: 291px; height: 8px"  align="center">
                层次
            </td>
            <td style="width: 216px; height: 8px"  align="center">
                专业
            </td>
            <td style="width: 199px; height: 8px"  align="center">
                入学方式
            </td>
            <td style="width: 154px; height: 8px"  align="center">
                姓名
            </td>
            <td style="width: 149px; height: 8px" align="center">
                证件号码
            </td>
            <td style="width: 151px; height: 8px"  align="center">
                档案号
            </td>
            <td style="width: 200px; height: 8px"  align="center">
                报名方式
            </td>
        </tr>
         <%
             set rsCondition = Server.CreateObject("ADODB.RecordSet")           
             dim strCondition
             strCondition="select top 100 stu.stu_level,fdz.fdzname,st.studykind,sub.subject,stu.entranceway,stu.studentname,stu.cardid,stu.archieveid,stu.signstate"
             strCondition=strCondition+" from stusignsys as stu,fdzlist as fdz,studykindlist as st,subjectsys as sub where 1=1"  
             if studentname<>"" and cardid<>"" then
                 strCondition=strCondition+" and stu.studentname='" & studentname & "' and stu.cardid='" & cardid & "'"                 
             else   
                 if stu_level<>"" then
                     strCondition=strCondition+" and stu.stu_level='" & stu_level & "'"         
                 end if

                 if fdzid<>"" then                              
                     strCondition=strCondition+" and fdz.fdzid='" & fdzid & "'"            
                 end if
   
                 if studykindid<>"" then               
                    strCondition=strCondition+" and st.studykindid='" & studykindid & "'"   
                 end if

                 if subjectid<>"" then
                     strCondition=strCondition+" and sub.subjectid='" & subjectid & "'"         
                 end if   
             end if   
            if rdo="专业号" then
                strCondition=strCondition+" order by sub.subject"   
            else if rdo="档案号" then
                strCondition=strCondition+" order by stu.archieveid"
            else
                strCondition=strCondition+" order by st.studykind"
            end if
            end if         
            rsCondition.Open strCondition,conn,1,1
         %>
         <%
             rsCondition.PageSize=10        '每页100条记录
             PageNum=rsCondition.PageCount   '总共10页  
             if page<=0 then page=1          '因为then之后的语句没有换行,所以无需加End if
             if page="" then page=1         
             if rsCondition.eof and rsCondition.bof then
                 response.write ("暂时还没有数据")
             else
                 rsCondition.AbsolutePage=page                             
             for i=1 to rsCondition.PageSize
                 if rsCondition.eof then exit for   
          %>
         <tr>
                <td style="width: 154px; height: 28px" align="center">
                    <%=rsCondition("stu_level")%>
                </td>
                <td style="width: 367px; height: 28px" align="center">
                    <%=rsCondition("fdzname") %>
                </td>
                <td style="width: 291px; height: 28px" align="center">
                    <%=rsCondition("StudyKind") %>
                </td>
                <td style="width: 216px; height: 28px" align="center">
                    <%=rsCondition("Subject") %>
                </td>
                <td style="width: 199px; height: 28px" align="center">
                    <%=rsCondition("entranceway") %>
                </td>
                <td style="width: 154px; height: 28px" align="center">
                    <%=rsCondition("studentname") %>
                </td>
                <td style="width: 149px; height: 28px" align="center">
                    <%=rsCondition("cardid") %>
                </td>
                <td style="width: 151px; height: 28px" align="center">
                    <%=rsCondition("archieveid") %>
                </td>
                <td style="width: 200px; height: 28px" align="center">                 
                    <%
                        select case rsCondition("signstate")
                        case 0
                            response.Write ("网上")
                        case else
                            response.Write ("纸介")
                        end select
                     %>                  
                </td>
            </tr>
          <%   
                rsCondition.movenext                     
          %>
          <%               
                next
                end if
          %>      
    </table>
    <br />
    <br />
   </div>
   <p align="center">
    <% if page=1 and not page=PageNum Then %>
    <font color='#008000'>第一页|上一页|</font>
    <font color='#008000'><a href="#" onclick="javascript:pageDown()">下一页</a>|</font>
    <font color='#008000'><a href="#" onclick="javascript:pageEnd('<%=PageNum%>')">最后一页</a>|</font>
    <font color='#008000'><% else if page<>1 and not page=PageNum Then%></font>
    <font color='#008000'><a href="#" onclick="javascript:pageHome()">第一页</a>|</font>
    <font color='#008000'><a href="#" onclick="javascript:pageUp()">上一页</a>|</font>
    <font color='#008000'><a href="#" onclick="javascript:pageDown()">下一页</a>|</font>
    <font color='#008000'><a href="#" onclick="javascript:pageEnd('<%=PageNum%>')">最后一页</a>|</font>
    <font color='#008000'><% else if page=PageNum then%></font>
    <font color='#008000'><a href="#" onclick="javascript:pageHome()">第一页</a>|</font>
    <font color='#008000'><a href="#" onclick="javascript:pageUp()">上一页</a>|</font>
    <font color='#008000'>下一页|</font>
    <font color='#008000'>最后一页</font>
    <%
        end if
        end if
        end if
    %>
    <% Response.Write("<font color='#008000'>  第"&page&"页 共"&rsCondition.RecordCount&"条记录 共"&PageNum&"页</font>")  %>
     </p>
     <input type="hidden" name="page" value="<%=page%>" />
     </form>
</body>
</html>
代码有点长,三个单选按钮就在form表单最开始的地方
2009-07-13 18:22
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:0 
为什么还是不明白?一定要给你代码才知道怎么弄吗
2009-07-14 14:39
xuanwang
Rank: 1
等 级:新手上路
帖 子:117
专家分:0
注 册:2009-6-29
收藏
得分:0 
我已经知道该怎么做了。多谢。。。。
2009-07-14 17:44
快速回复:请教:单选按钮问题!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020816 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved