在确认消息ASP.NET [英] Confirm message in ASP.NET

查看:94
本文介绍了在确认消息ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在code写这说明书:

I wrote this statment in my code:

Response.Write("<script language=javascript>confirm('The system not allow negative inventory,continue?');</script>");

如何韩德尔如果用户点击确定或取消按钮?

how can I handel if the user clicked "Ok" or "Cancel" button?

推荐答案

限制我的回答对Javascript和没怎么你的code的结果将与页面的流量交互,JavaScript的确认方法返回用户所选择的选项的值:

Restricting my answer to Javascript and not how the result of your code would interact with the flow of the page, the Javascript confirm method returns the value of the user's selected option:

var result = confirm('The system does not allow negative inventory. Continue?');
if (result == true)
  // The user wants to continue. Proceed accordingly.
else
  // The user does not want to continue.

您可以使用该值相应分支你的逻辑。

You can use the value to branch your logic accordingly.

这篇关于在确认消息ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆