参考 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. 大型票务系统中username和password的安全性问题

    讨论请移步至:http://www.zhiliaotech.com/ideajam/idea/detail/307 相关文章: <今天你买到票了吗?--从铁道部12306.cn站点漫谈电子商务站 ...

  2. 通过pull解析器操作安卓的xml

    通过pull解析器操作安卓的xml 例子定义了一个javabean用于存放上面解析出来的xml内容, 这个javabean为Person,代码请见本页下面备注: =================== ...

  3. HTML:scrollLeft,scrollWidth,clientWidth,offsetWidth到底指的哪到哪的距离之完全详解

    scrollHeight: 获取对象的滚动高度. scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离 scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最 ...

  4. SQL学习之组合查询(UNION)

    1.大多数的SQL查询只包含从一个或多个表中返回数据的单条SELECT语句,但是,SQL也允许执行多个查询(多条SELECT语句),并将结果作为一个查询结果集返回.这些组合查询通常称为并或复合查询. ...

  5. Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation

    Xposed出现 java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implem ...

  6. ASP.NET动态生成图片样式的验证码

    我们在设计用户登录模块时,经常会用到验证码,可以有效地防止黑客软件的恶意破解. 在此我就直接放置一个网页链接,以后用的时候可以当做备忘! 此连接中有多种验证码图片的样式可供参考. http://www ...

  7. Java DecimalFormat 格式化数字

    我们经常要将数字进行格式化,比如取2位小数,这是最常见的.Java 提供 DecimalFormat 类,帮你用最快的速度将数字格式化为你需要的样子.下面是一个例子: importjava.text. ...

  8. A - A

    A - A Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status ...

  9. php 解析xml 的四种方法(转)

    XML处理是开发过程中经常遇到的,PHP对其也有很丰富的支持,本文只是对其中某几种解析技术做简要说明,包括:Xml parser, SimpleXML, XMLReader, DOMDocument. ...

  10. hdu 4031 Attack 线段树

    题目链接 Attack Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total ...