javascript BootstrapDialog.alert() 没有出现

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23118088/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 00:22:02  来源:igfitidea点击:

BootstrapDialog.alert() not showing up

javascripthtmltwitter-bootstrap-3dialogbootstrap-dialog

提问by Chandu

I am using the following code to show a BootstrapDialog and its not showing up Please help

我正在使用以下代码来显示 BootstrapDialog 但它没有显示 请帮忙

<!DOCTYPE HTML>
<html>
<head>
<title>dialog box example</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">

</head>
<body>
    <input type="button"  value="button1" class="btn btn-info" onclick="showmes();">


        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

    <script>
    function showmes() {
        BootstrapDialog.show(typeof(BootstrapDialog)); //.alert('I want banana!');
    }
    </script>
</body>
</html>

回答by Thomas

BootstrapDialog is not part of the bootstrap library, it is a part from an external javascript librarybuilt on top of bootstrap.

BootstrapDialog 不是 bootstrap 库的一部分,它是构建在 bootstrap 之上的外部 javascript 库的一部分。

Therefore, you must include the bootstrap-dialog.jsand the bootstrap-dialog.min.css(or respectively minimal versions). You can build the files yourself following the readme, or get them from the js and css subfolders of the distfolder.

因此,您必须包含bootstrap-dialog.jsbootstrap-dialog.min.css(或分别是最小版本)。您可以按照自述文件自行构建文件,也可以从dist文件夹的 js 和 css 子文件夹中获取它们。