我有这个代码:
<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;