1

私はこのコードを持っています:

<td style="text-align: center;">
            <asp:DropDownList ID="ddlOpRep" runat="server" Width="70px">
                <asp:ListItem Value="1">1</asp:ListItem>
                <asp:ListItem Value="2">2</asp:ListItem>
                <asp:ListItem Value="3">3</asp:ListItem>
            </asp:DropDownList>
        </td>

ここで、ddlOpRep で選択した値を含む確認メッセージを表示したいと思います。

<asp:Button ID="btnRelease" runat="server" Text="Release" Width="130px" 
         OnClientClick="return confirmRelease();" onclick="btnRelease_Click" />

<script type="text/javascript">
    function confirmRelease() {
        var OpRep = document.getElementById("ddlOpRep");           

        return confirm('Are you sure you want to release this configuration: OpRep: ' + OpRep + ' ?');
    }
</script>

しかし、私は得nullていますvar OpRep = document.getElementById("ddlOpRep");

だから手に入れる可能性すら無いvar OpRep = document.getElementById("ddlOpRep").value;

4

3 に答える 3