参考 http://www.bootcss.com/javascript.html#alerts

不过这里没有动态alert的例子

于是再参考http://stackoverflow.com/questions/10082330/dynamically-create-bootstrap-alerts-box-through-javascript

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" /> <link href="../css/bootstrap.css" rel="stylesheet">
<script src="../js/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../js/bootstrap.js" type="text/javascript"></script>
</head>
<body>
<div style="height:200px;"></div>
<!-- alert-error 是红色警告 -->
<div class="alert alert-block alert-error fade in" style="height:0px">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4 class="alert-heading">Error!</h4>
<p>Error!Error!Error!Error!Error!Error!Error!Error!
</p>
<p>
<a class="btn btn-danger" href="#">Take this action</a>
<a class="btn" href="#" data-dismiss="alert" >Or do this</a>
</p>
</div>
<div style="padding:50px;margin:50px;"></div> <input type = "button" id = "clickme" value="Click me!"/>
<div id = "alert_placeholder"></div>
<script type="text/javascript">
$(function(){
//$(".alert").animate({height:"121px"},1500);
$(".alert").alert();
}); </script>
<script>
bootstrap_alert = function() {}
bootstrap_alert.warning = function(message) {
$('#alert_placeholder').html('<div class="alert"><a class="close" data-dismiss="alert">×</a><span>'+message+'</span></div>')
} $('#clickme').on('click', function() {
bootstrap_alert.warning('Your text goes here');
});
</script>​
</body>
</html>

Bootstrap Alert 使用的更多相关文章

  1. bootstrap插件学习-bootstrap.alert.js

    我们先看bootstrap.alert.js的结构 var dismiss = '[data-dismiss="alert"]' //自定义属性 Alert = function ...

  2. Bootstrap Alert Auto Close

    http://stackoverflow.com/questions/23101966/bootstrap-alert-auto-close http://jsfiddle.net/mfX57/ $( ...

  3. 基于springboot+bootstrap+mysql+redis搭建一套完整的权限架构【六】【引入bootstrap前端框架】

    https://blog.csdn.net/linzhefeng89/article/details/78752658 基于springboot+bootstrap+mysql+redis搭建一套完整 ...

  4. angularjs 指令详解 - template, restrict, replace

    通过指令机制,angularjs 提供了一个强大的扩展系统,我们可以通过自定义指令来扩展自己的指令系统. 怎样定义自己的指令呢? 我们通过 Bootstrap UI来学习吧.这个项目使用 angula ...

  5. 具备 jQuery 经验的人如何学习AngularJS(附:学习路径)

    这是一个来自stackoverflow的问答,三哥直接把最佳回答搬过来了. 都说AngularJS的学习曲线异常诡异~~~ Q: “Thinking in AngularJS” if I have a ...

  6. [译]用AngularJS构建大型ASP.NET单页应用(三)

    原文地址:http://www.codeproject.com/Articles/808213/Developing-a-Large-Scale-Application-with-a-Single A ...

  7. Javascript 插件统一的实现步骤

    步骤: // 1. 定义立即调用的函数 +function($){ "use strict"; //使用严格模式ES5支持 //后续步骤 // 2. xx 插件类及原型方法的定义 ...

  8. 关于js中this的疑问

    学习bootstrap.js源码中被js里边的this绕的有点晕 /* ================================================================ ...

  9. Yii 设置 flash消息 创建一个渐隐形式的消息框

    /*适用情况:比如提交一个表单,提交完成之后在页面展示一条提示消息. 控制器里面这样写: 单条消息: */ \Yii::$app->getSession()->setFlash('erro ...

随机推荐

  1. 交互设计师谈颠覆式创新 | Think different

    作者:Teambition 交互设计师 樊伟 本文由 Teambition 原创.转载请注明出处,附原文链接 题图:by Ed Chao 我们不需要像主流市场的大公司一样做类似相扑的庞大,而是需要像柔 ...

  2. T-SQL语句中中括号([])的用法是什么,什么时候该用

    加了[]是为了防止歧义,使计算机能识别.有些字段可能是关键字,这时候你直接用字段名就会报错,如果加了[]就可以正常执行了

  3. Memcached基础

    1.实例化 MemcachedClient client = new XMemcachedClient(); public XMemcachedClient() public XMemcachedCl ...

  4. ##DAY15——UICollectionView

    DAY15——UICollectionView 创建UICollectionView //创建一个布局对象,采用系统布局类UICollectionViewFlowLayout UICollection ...

  5. Windows下提升进程权限(转)

    from: http://www.oschina.net/code/snippet_222150_19533 windows的每个用户登录系统后,系统会产生一个访问令牌(access token) , ...

  6. tengine install

    ./configure --prefix=/home/admin/local/tengine --with-http_stub_status_module --with-http_ssl_module ...

  7. symfony2 关于是否需要建立多bundle

    http://blog.danielribeiro.org/yes-you-can-have-low-coupling-in-a-symfony-standard-edition-applicatio ...

  8. codeforces 630P. Area of a Star

    题目链接 圆上n个点等距离分布, 求构成的星星的面积. 我们可以求三角形OAB的面积, ∠CAE = 1/2 ∠ COE = PI/n, 那么∠CAO = PI/2n, ∠AOB非常好求, 就是PI/ ...

  9. poj 1966 Cable TV Network 顶点连通度

    题目链接 给一个图, n个点m条边, 求至少去掉多少个点可以使得图不再联通.随便指定一个点为源点, 枚举其他点为汇点的情况, 跑网络流, 求其中最小的情况. 如果最后ans为inf, 说明是一个完全图 ...

  10. Linux平台下使用rman进行oracle数据库迁移

        实验目的:将oracle数据库从一台机器迁移到另外的一台机器(同为linux平台),设置为不同的路径,不同的实例名 源端: ORACLE_BASE=/u01/app/oracle ORACLE ...