有一个dropdownlist 和一个button ,当我选择完dropdownlist选项后点击button 按钮提交的时候我希望弹出一个对话框  显示出我刚才所选择的dropdownlist 值,并且有一个提示是否确定提交或者是取消。这个应该怎么做

解决方案 »

  1.   

    var value = droplist1.options[droplist1.selectedIndex].value
    if(confirm('确定选择' + value + '吗?'))
    {
       //true
    }
    else
    {
       //false;
    }
      

  2.   

    <asp:button onclientclick="check()" />
      

  3.   

    <form id="form1" runat="server">
        <div>
            <asp:DropDownList ID="DropDownList1" runat="server">
                <asp:ListItem>aaa</asp:ListItem>
                <asp:ListItem>bbb</asp:ListItem>
            </asp:DropDownList>
            <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="confirm('是否确定选中'+document.getElementById('DropDownList1').value);"  />
    </div>
    </form>
      

  4.   

    this.Button1.Attributes.Add("onclick","return confirm('确实要选择"+this.dropdownlist.SelectedValue+"吗')")