空文本框确认<ok>或<cancle>。如果确定,则执行其他操作拒绝该应用程序

时间:2016-06-01 06:31:20

标签: c# asp.net

使用asp.net web应用程序中的以下消息框。现在我想将此消息框转换为确认消息框并在其为真时执行其他操作否则意味着拒绝该应用程序。

ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "confirm('Address,Phone Number,Email ID Is Empty Do You Want To Continue');", true);

1 个答案:

答案 0 :(得分:0)

<body>

<p>Click the button to display a confirm box.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction()
{
var x;
var r=confirm("Press a button!");
if (r==true)
  {
  x="You pressed OK!";
  }
else
  {
  x="You pressed Cancel!";
  }

}
</script>

</body>

http://www.aspsnippets.com/Articles/Server-Side-Code-Behind-Yes-No-Confirmation-Message-Box-in-ASPNet.aspx