Javascript 部分

function checkForDefaultAlertPlaceholder() {
if ($("#alertPlaceholder").length == 0) {
$("body > div:nth-child(2)").prepend($('<div id="alertPlaceholder"></div>'));
}
}
bootstrap_alert = function () { }
bootstrap_alert.danger = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-danger alert-dismissable fade in" role="alertdialog"><strong>Error:</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}
bootstrap_alert.warning = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-warning alert-dismissable fade in" role="alertdialog">' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}
bootstrap_alert.success = function (message, timeout, idContainer) {
if (idContainer == null) {
checkForDefaultAlertPlaceholder();
}
var $alert = $('<div class="alert alert-success alert-dismissable fade in" role="alertdialog"><strong>Success:</strong> ' + message + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button></div>');
$("#" + (idContainer != null ? idContainer : "alertPlaceholder")).append($alert);
if (timeout != null && timeout > 0) {
setTimeout(function () {
$alert.alert("close");
}, timeout);
}
return $alert;
}

将DIV加在表头某处:

<div id="alertPlaceholder"></div>

Ajax调用代码区:

 $('#').click(function(){
$.ajax({
type:'POST',
url:<link>,
data:{},
success:function(data){
bootstrap_alert.success("The data has been saved.", 1000);
},
error:function(data){
bootstrap_alert.danger("Exception!This operation is not performed successfully! Please contact admin!", 1000);
}
}); });

bootstrap 操作提示placeholder的更多相关文章

  1. 小技巧:SystemTray中进行操作提示

    SystemTray中进行操作提示在wp中应用比较广泛,截图如下. 实现方法也十分简单 1.xaml代码中写入: shell:SystemTray.IsVisible="True" ...

  2. AIX-vi操作-提示Unknown terminal type的问题解决方法

    AIX-vi操作-提示Unknown terminal type的问题解决方法AIX Version 5.3$ vi /etc/profilelinux: Unknown terminal type[ ...

  3. Bootstrap -- 插件: 提示工具、弹出框、 警告框消息

    Bootstrap -- 插件: 提示工具.弹出框. 警告框消息 1. 提示工具(Tooltip)插件:根据需求生成内容和标记. 使用提示工具: <!DOCTYPE html> <h ...

  4. wp8.1 app退出操作提示

    微软的wp8.1 sdk相比之前wp8 sdk以及相关dll类库,微软又重新编译过,相关系统类库也经过精简,删改了部分传统dll库中的方法对象,很多常用方法对象被写进Windows.UI为前缀的命名空 ...

  5. eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied

    eclipse的hadoop插件对集群操作提示org.apache.hadoop.security.AccessControlException:Permission denied: user = z ...

  6. Android使用ShowcaseView加入半透明操作提示图片的方法

    http://beeder.me/2014/11/11/how-to-add-a-semi-transparent-demo-screen-using-showcaseview/ 这篇文章具体介绍了如 ...

  7. flutter Tooltip轻量级操作提示

    Tooltip是继承于StatefulWidget的一个Widget,它并不需要调出方法,当用户长按被Tooltip包裹的Widget时,会自动弹出相应的操作提示. import 'package:f ...

  8. 数据库操作提示:Specified key was too long; max key length is 767 bytes

    操作重现: 法1:新建连接——>新建数据库——>右键数据库导入脚本——>提示:Specified key was too long; max key length is 767 by ...

  9. HTML5表单提示placeholder属性兼容IE

    placeholder 属性提供可描述输入字段预期值的提示信息(hint). 该提示会在输入字段为空时显示,并会在字段获得焦点时消失. 注释:placeholder 属性适用于以下的 <inpu ...

随机推荐

  1. django之多表查询-2

    2018-11-14 一 \\ 基于双下划线的跨表查询: 套路一样,用__跨表 -一对多 -多对多 from app.models import * 查询出版社为北京出版社出版的所有图书的名字,价格 ...

  2. tornado requesthandler可以重写的方法

    一 :RequestHandler 一般我们继承tornado.web.RequestHandler 1,RequestHandler.initialize()一般用于初始化,第三个字典参数传入 cl ...

  3. linux下Pl353 NAND Flash驱动分析

    linux的NAND Flash驱动位于drivers/mtd/nand子文件夹下: nand_base.c-->定义通用的nand flash基本操作函数,如读写page,可自己重写这些函数 ...

  4. Thinkphp的list_to_tree 实现无限级分类列出全部节点

    list_to_tree 使用起来十分方便,具体可查看手冊.由于我在用的时候须要同一时候列出全部节点,所以写了一个递归函数,拿出来供大家參考. public function index(){ Loa ...

  5. C++中的默认成员函数

    一般而言,对于一个用户自定义的类类型,以下四个函数在用户没有自定义的情形下,会由编译器自动生成: 1.default constructor 2.copy constructor Someclass: ...

  6. go——并发(二)

    通常程序会被编写为一个顺序执行并完成一个独立任务的代码. 如果没有特别的需求,最好总是这样写代码,因为这种类型的程序通常很容易写,也容易维护. 不过也有一些情况下,并行执行多个任务会有更大的好处. 一 ...

  7. day2 笔记

    while 条件:           # 循环体       # 如果条件为真,那么循环体则执行     # 如果条件为假,那么循环体不执行         循环中止语句 如果在循环的过程中,因为某 ...

  8. netty应用

    http://www.blogjava.net/yongboy/archive/2013/05/13/399203.html http://shentar.me/tag/netty-2/ 代理 htt ...

  9. velocity 使用笔记

    1. velocity获取字符串长度方法: 用length()就可以了,截取子字符串用substring(0,10) .$str.substring(0,3) 集合获取集合长度用:size() 2.  ...

  10. 属性检测 In,hasOwnPreperty()和propertyIsEnumerable()

    IN  左侧是属性名:右侧是对象名, 如果 属性是 自有属性 或者继承属性 则返回 TRUE var o={x:1,y:2} "x" in  o    返回 true: hasOw ...