您的位置:程序门 -> web 开发 -> asp



select option问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


select option问题
发表于:2008-01-21 15:57:28 楼主
大家好,表里的"ma"字段有1、2、3、4,我想根据表里的数据设置为selected="selected"显示,像这样的是怎样实现,请大家帮帮忙。
<select   name="ma"
    <option   value="1"> aa </option>
    <option   value="2"> bb </option>
    <option   value="3"> cc </option>
    <option   value="4"> dd </option>
</select>
发表于:2008-01-21 15:59:441楼 得分:0
<select       name="ma"  
        <option       value="1">   aa   </option>  
        <option       value="2"   selected>   bb   </option>  
        <option       value="3">   cc   </option>  
        <option       value="4">   dd   </option>  
</select>  
发表于:2008-01-21 16:03:232楼 得分:0
不明白
发表于:2008-01-21 16:11:343楼 得分:0
意思就是表里的字段要是等3就在   <option   value="3"   selected="selected">   cc   </option>    
发表于:2008-01-21 16:12:144楼 得分:0
<select       name="ma"  
        <option       value="1"   <%if   rs(1)=1   then   response.write("selected")%> >   aa   </option>  
        <option       value="2"   <%if   rs(1)=2   then   response.write("selected")%> >     bb   </option>  
        <option       value="3"   <%if   rs(1)=3   then   response.write("selected")%> >     cc   </option>  
        <option       value="4"   <%if   rs(1)=4   then   response.write("selected")%> >     dd   </option>  
</select>

是要这样吗?
发表于:2008-01-21 16:29:155楼 得分:0
<select   name="ma">      
                <option   value="1"   <%if   rs("ma")=1   then   response.write("selected")%>   > aa </option>      
                  <option   value="2"   <%if   rs("ma")=2   then   response.write("selected")%>   > bb </option>      
                <option   value="3"   <%if   rs("ma")=3   then   response.write("selected")%>   > cc </option>      
                <option   value="4"   <%if   rs("ma")=4   then   response.write("selected")%>   > dd </option>      
</select>  
发表于:2008-01-21 16:47:286楼 得分:0
像楼上那样写就可以了
发表于:2008-01-21 17:29:567楼 得分:0
楼上的都给出答案了。。。。。     4楼   5楼的都可以参考。


快速检索

最新资讯
热门点击