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. 重读C库之宏定义

    1.如何编写头文件.h? //file--func1.h #ifndef __FUNC1_H //__func1_h //可小写可大写 #define __FUNC1_H //__func1_h .. ...

  2. Tensorflow神经网络进行fiting function

    使用Tensorflow中的神经网络来拟合函数(y = x ^ 3 + 0.7) # -*- coding:utf-8 -*-import tensorflow as tf import numpy ...

  3. phpexcel导出带生成图片完美案例

    // 导出exl public function look_down(){ $id = I('get.id'); $m = M ('offer_goods'); $where['offer_id'] ...

  4. 关于delphi软件运行出现Invalid floating point operation的错误的解决办法

    关于delphi软件运行出现Invalid floating point operation的错误的解决办法   关于delphi软件运行出现Invalid floating point operat ...

  5. Python:笔记(4)——高级特性

    Python:笔记(4)——高级特性 切片 取一个list或tuple的部分元素是非常常见的操作.Python提供了切片操作符,来完成部分元素的选取 除了上例简单的下标范围取元素外,Python还支持 ...

  6. Eclipse 中安装Browse Deployment Location插件

    Browse Deployment Location 功能的插件名称为: Pivotal tc Server Integration for Eclipse  可在Eclippse的Eclipse M ...

  7. linux crontab命令 自动下载文件

    #crontab -e#download stock data, Mon-Fri, 9:15 - 11:30, 13:00 - 15:0015,30,40,50 9 * * 1-5 (cd /home ...

  8. Eclipse+maven 导致Eclipse启动后Build workspaces卡死或者下载缓慢的问题

    参考文档: (1)Eclipse 一直不停 building workspace完美解决总结 (2)eclipse 一直building workspace 问题 解决办法: (1)第一步: 修改ec ...

  9. docker 中安装PHP扩展

    可以通过两种方式实现 1.pecl pdo_msql 方式二: docker-php-ext-install pdo pdo_mysql 如果报 /usr/local/bin/docker-php-e ...

  10. SVN使用—常用命令及避免冲突的方法

    一.SVN启动 [root@localhost ~]# mkdir /data/svn [root@localhost ~]# svnadmin create /data/svn/test [root ...