如何为弹出窗口提供两个按钮 [英] how to give two buttons for popup window

查看:92
本文介绍了如何为弹出窗口提供两个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为弹出窗口提供两个按钮.我为onclientclick事件设置了按钮.我想显示确定吗?消息...但是它只显示确定按钮...在这里我想显示两个确定按钮并单击取消...当用户要单击取消"按钮时,它将shd重定向到其他页面,并且对另一个按钮相同.

how to give two buttons for popup window.i have on button for tht i have given onclientclick event.i want to display Are you sure? message...but it displays only ok button...here i want to display two buttons ok and cancel...when user want to click on cancel button it shd redirects to other page and same for another button.

推荐答案

在js中,如果您使用js的警报功能,而不是使用而不是诸如此类的确认功能:

in js if you use alert function of js than use instead of confirm function like that:-


function Show1()
        {
            if(confirm('I want ot disply are you sure ?') == true)
             {

// --- write code if user click on ok button  
             }
             else
             {
                 // --- write code if user click on cancel button
             }
        }




Google可以为您面临的问题节省大量时间.解决您的问题的方法是使用确认消息框,您可以像下面这样实现

Hi,

Google can save lots of time for issues like you are facing. Solution to your problem is using confirm message box, you can implement like below

var result = confirm('Are you sure you want to leave the page?');
if (result == true)
  // The user wants to continue. Proceed accordingly.
else
  // The user does not want to continue.



有关更多详细信息,请参见 [



For more details see this[^] reference.

You can also considered using

window.onbeforeunload


请参阅
[


See this[^] example.
Hope this will help.


这篇关于如何为弹出窗口提供两个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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