得到的ASP.NET C#返回确认popbox值 [英] Get the return confirm popbox value in asp .net C#

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

问题描述

我怎样才能得到这可是价值$ P $在确认框pssed?

 <脚本类型=文/ JavaScript的LANGUAGE =JavaScript的>
        功能confirm_proceed()
        {
            如果(确认(你确定要继续?)==真)
                返回true;
            其他
                返回false;
        }
    < / SCRIPT>

C#

  Button2.Attributes.Add(onclick事件,返回confirm_proceed(););


解决方案

试试这个,如果这是一个具有这种行为的唯一按钮

  Button2.Attributes.Add(onclick事件,返回确认('你确定要继续吗?'));

这是内联,看起来简单,但如果你有这样的行为,多个控件,然后你原来的做法是易于维护。

和原来的功能,可以为皱缩

 <脚本类型=文/ JavaScript的LANGUAGE =JavaScript的>
        功能confirm_proceed()
        {
            返回确认(你确定要继续吗?);
        }
 < / SCRIPT>

How can i get the value that was pressed in the confirm box?

 <script type = "text/javascript" language = "javascript">
        function confirm_proceed()
        {
            if (confirm("Are you sure you want to proceed?")==true)
                return true;
            else
                return false;
        }
    </script> 

C#

  Button2.Attributes.Add("onclick", "return confirm_proceed();");

解决方案

Try this, if this is the only button that has this behavior

Button2.Attributes.Add("onclick", "return confirm('Are you sure you want to proceed?')");

it's inline and looks straightforward but if you have multiple controls that behave this way then your original approach would be easy to maintain.

And your original function could be shrunken to

 <script type = "text/javascript" language = "javascript">
        function confirm_proceed()
        {
            return confirm("Are you sure you want to proceed?");
        }
 </script> 

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

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