我设置了一个dropdownlist,当他指向删除时将跳出来一个确认框,现在确认框弹出来了,但可惜的是点击确定和取消却都是执行下面的程序啊!求大神告知原因啊……谢谢!
js部分的代码是
function getconfirm2(choose)
{
if (choose.value == "2")
{
if(confirm("2确定要将此条记录移到修理完成?"))
return true;
else
return false;
}
}
dropdownlist的代码
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged"
OnChange="getconfirm2(this)">
js部分的代码是
function getconfirm2(choose)
{
if (choose.value == "2")
{
if(confirm("2确定要将此条记录移到修理完成?"))
return true;
else
return false;
}
}
dropdownlist的代码
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged"
OnChange="getconfirm2(this)">
OnChange = "if(getconfirm2(this)) return false;"function getconfirm2(choose)
{
if (choose.value == "2")
return confirm("2确定要将此条记录移到修理完成?");
}
OnChange = "if(getconfirm2(this)) return false;"
更正
OnChange = "if(!getconfirm2(this)) return false;"
getconfirm2(this)中改成
if(confirm("2确定要将此条记录移到修理完成?"))
{document.write("你点击了确认!")}
else
{document.write("你点击了取消!")}看看效果
alert();
选中value值