0

私はaspclassic(.netなし)を使用しています。ユーザーのリストがあり、ユーザー(id_rolで並べ替えられている)が変更されたとき、たとえばユーザーが検索した場合に、ある種のラベルを付けようとして立ち往生しています。最初のオプションのリスト( "Todos")は、すべてのユーザーを表示できることを意味しますが、彼が1に見える場合、id_rol = 1の10人のユーザーを表示でき、このリストの12の場所を見ると、「Editor」というラベルが表示されます。他の10人のユーザーを示していますが、私の問題は、オプションが0の場合はTODOを示し、1の場合はDIRECTORを示し、以下のユーザーを示し、選択が12の場合はDIGITADORを示し、その説明は、リスト内の場所が22の場合、EDITORを示し、続行します。

ここに画像の説明を入力してください rigthは、0、1、2、および3の場所にオプションがあることを示していますが、0、1、12、および22の場所にオプションが必要ですか?お願いします。これが私のコードです:

function cb_usuarios(cod_usuario)
'response.write seccion&"<*------"
sql=" select * from usuarios where 1=1"
'sql=" select * from usuarios where 1=1 order by id_rol asc"
if Session("id_perfil") ="1" then sql = sql &" and id_rol in(3,4)"
if Session("id_perfil") ="2" then sql = sql &" and id_rol=3"
if Session("id_perfil") ="3" then sql = sql &" and id_rol in(3,4,7)"
if Session("id_perfil") ="4" then sql = sql &" and id_rol in(1,7,6)"
if Session("id_perfil") ="6" then sql = sql &" and id_rol in(7,4)"
'sql = sql &" order by nombre "
 sql = sql &" order by id_rol "

'if(id_rol=1)then
'response.write director
'else
'response.write('esto es una prueba')
'response.write sql
Set rsx = Server.CreateObject("ADODB.Recordset")
rsx.Open SQL, conexion, 3
%>

Usuarios<select name="usuarios" class="filtros">
<option selected value="0">TODOS</option>
<option selected value="1">DIRECTOR</option>
<option selected value="12">DIGITADOR</option>
<option selected value="22">EDITOR</option>

<%
while not rsx.eof
if ( trim(rsx("usuario")) = trim(cod_usuario)) then
sel="Selected"
else
sel=""
end if 
%>
<option select value="<%=rsx("usuario")%>" <%=sel%>><%=rsx("nombre")%></option>
<%
rsx.movenext
wend
rsx.close
%></select><%
end function
4

2 に答える 2

0

このコードはトリックを作りました:

ここに画像の説明を入力してください

function cb_usuarios(cod_usuario)
'response.write seccion&"<*------"


     sql=" select * from usuarios where 1=1"
    'sql=" select * from usuarios where 1=1 order by id_rol asc"


            if Session("id_perfil") ="1" then sql = sql &" and id_rol in(3,4)"
            if Session("id_perfil") ="2" then sql = sql &" and id_rol=3"
    if Session("id_perfil") ="3" then sql = sql &" and id_rol in(3,4,7)"
    if Session("id_perfil") ="4" then sql = sql &" and id_rol in(1,7,6)"
    if Session("id_perfil") ="6" then sql = sql &" and id_rol in(7,4)"

        'sql = sql &" order by nombre "
     sql = sql &" order by id_rol "

    'if(id_rol=1)then
    'response.write director
    'else
    'response.write('esto es una prueba')






'   response.write sql
    Set rsx = Server.CreateObject("ADODB.Recordset")
    rsx.Open SQL, conexion, 3
%>

Usuarios<select name="usuarios" class="filtros">

        <option selected value="0">TODOS</option>





    <%
    while not rsx.eof
        if ( trim(rsx("usuario")) = trim(cod_usuario)) then
            sel="Selected"
        else
            sel=""
        end if 
                    if ( trim(rsx("id")) =9) then
                     %>
        <option select value="0" <%=sel%>>======DIRECTOR=======</option>
        <%
                      end if
                     if ( trim(rsx("id")) =47) then
                     %>
        <option select value="0" <%=sel%
>>======DIGITADOR=======</option>
        <%
                      end if
                  if ( trim(rsx("id")) =37) then
                  %>
        <option select value="0" <%=sel%>>=====EDITOR========</option>
        <%
        end if
        if ( trim(rsx("id")) =24) then
                  %>
        <option select value="0" <%=sel%>>=====SUPERVISOR
JEFE========</option>
        <%
        end if
        if ( trim(rsx("id")) =41) then
                  %>
        <option select value="0" <%=sel% 
 >>=====ADMINISTRADOR========</option>
        <%
        end if
        if ( trim(rsx("id")) =43) then
                  %>
        <option select value="0" <%=sel%
 >>=====SUPERVISOR========</option>
        <%
        end if

        if ( trim(rsx("id")) =29) then
                  %>
        <option select value="0" <%=sel%
 >>=====CODIFICACION========</option>
        <%
        end if      %>
        <option select value="<%=rsx("usuario")%>" <%=sel%>><%=rsx
 ("nombre")%></option>
        <%
        rsx.movenext
    wend
    rsx.close
%></select><%
 end function
于 2012-07-05T21:41:14.740 に答える
0

selectの構文は...

<select>
    <option value="1">unos</option>
    <option selected value="2">duos</option>

次のようなものはありません:オプション選択値....選択が間違っているhtml選択されたのはhtmlだけです

于 2012-07-06T17:46:47.607 に答える