如何写确认信息? [英] How to write confirmation message?

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

问题描述

您好

我想写确认信息

例如,当我填写表格并点击添加按钮时,我想收到一条消息你确定要添加....当我点击确定时,应该在数据库中添加项目,当单击取消时,表格应保持不变..



请帮帮我..



谢谢你

Hello
I want to write the confirmation message
For example when i fill in a form and click on the button "Add" I want to get a message "Are you sure you want to add...." and when i click ok the items should be added in the database and when 1 click cancel the form should remain as it was..

Please help me..

Thank u

推荐答案

使用javascript函数调用按钮的OnClick事件



eg)

Call the javascript function using OnClick event of the button

eg)
<html>
<head>
  <script language="javascript">
    function myfunction()
     {
      
    var r=confirm("Are you sure to continue");
if (r==true)
  {
  return true;
  }
else
  {
  return false;
  }

     }
  </script>
</head>
.
.
<form name="n_form">
   <input type="text" name="name">
   <input type="text" name="name">
   <input type="submit"  önclick="myfunction()" name="submit">
</input></input></input></form>
.
.
.
</html>


包含 Onclientclick 添加按钮



试试这个:

Include Onclientclick in add button

Try this:
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return confirm(&quot;Are you sure you want to Add?&quot;);" />


check ....



http://stackoverflow.com/questions/9139075/confirm-message-before-delete [ ^ ]
check....

http://stackoverflow.com/questions/9139075/confirm-message-before-delete[^]


这篇关于如何写确认信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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