自定义提醒/确认框 [英] Custom alert/confirmation box

查看:89
本文介绍了自定义提醒/确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以制作与本地JavaScript窗口具有相同行为的自定义alert/confirm/prompt(使用回调/异步事件)?

Is it possible to make a custom alert/confirm/prompt that have the same behaviour as native javascript windows (without using callbacks/asynchronous events)?

例如:

if(mytest == true){

    myCustomMsgWindow('message'); //Pause execution
    //do something

}

我尝试过一次,但是dint可以用于确认窗口,因为它必须返回一个值.

I tried this once but dint works for confirm window because it must return a value.

推荐答案

您可以自定义,但其行为却不相同.

因为在浏览器中,这些框会暂停执行线程,并通过用户操作恢复.您不能暂停执行线程,这是隐式的.

Because in the browsers these boxes pause the execution thread, and resumed by user action. you can not pause the execution thread, this is implicit.

但是,有些解决方法的行为几乎相似.你可以试试看 BootBox

However there are some workaround which may behave almost similar. You can try that BootBox

这篇关于自定义提醒/确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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