如何在保存按钮的javascript中显示弹出消息? [英] How to show the popup message in javascript for on Save Button?

查看:72
本文介绍了如何在保存按钮的javascript中显示弹出消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在保存按钮上显示弹出消息,用户无法更新详细信息。我怎样才能实现这一目标?

I wanted to show popup message on the save button and user should not able to update the details . How can I achieve this ?

推荐答案

在客户端编写javascript函数。假设函数名是fnABC()。

定义fnABC()的主体并在函数中弹出警告框。





现在,在代码隐藏页面中编写Save按钮的代码。保存数据后调用以下行。



Page.ClientScript.RegisterStartupScript(this.GetType(),Diag,fnABC()); < br $>




以上代码片段将调用javascript函数并发出警告信息。
Write javascript function in the client side. Suppose function name is fnABC().
Define the body of fnABC() and put alert box for pop up in the function.


Now, write the code of Save button in the code behind page. And call the below line after saving the data.

Page.ClientScript.RegisterStartupScript(this.GetType(), "Diag", "fnABC()");


Above snippet of code will call the javascript function and raise alert message.


function ConfirmSave(){
    var isconfirm = window.confirm("Do you want to save it?");
    if(isconfirm)
        self.location = "Save.php";
}




<input type="button" value="Save"  onclick=ConfirmSave()>





写一个函数如上然后调用它点击按钮。

在这种情况下,保存功能写在'Save.php'文件中,你可以替换你的保存功能。



Write a function as above and then call it onclick of button.
In this case, Save function is written in 'Save.php' file, you can replace your save function.


这篇关于如何在保存按钮的javascript中显示弹出消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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