我想向用户显示一条消息,以选择是或否。根据单击的按钮(是或否),应将值作为参数传递给查询。我怎样才能做到这一点。到目前为止,这是我所做的。
<script type="text/javascript">
function confirm()
{
var confirmValue = document.createElement("INPUT");
confirmValue.type = "hidden";
confirmValue.name = "confirmValue";
if (confirm("Do you want to finalize? If you click yes, you will not be able to update and application will be passed to the MBD Coordinator")) {
confirmValue.value = "YES";
}
else
{
confirmValue.value = "NO";
}
document.forms[0].appendChild(confirmValue);
}
</script>
<asp:Button ID="btnFinish" runat="server" Text="Finish" BorderStyle="Solid" BorderColor="#9B0423"
Font-Bold="true" Width="100px" Height="30px" ForeColor="#9B0423" Style="margin-right:20px;" OnClick="btnFinish_Click" OnClientClick = "confirm()"/>
这是C#代码
string confirmValue = Request.Form["confirmValue"];
if (confirmValue == "Yes")
{
string value = "YES";
}
else
{
string value = "NO";
}
但是在这种情况下,我没有得到任何消息来选择任何选项。
将功能名称从“确认”更改为其他名称。您将覆盖JavaScript中的默认确认功能。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句