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. 0407-服务注册与发现-Eureka深入理解-元数据、高可用HA

    一.Eureka元数据 参看地址:https://cloud.spring.io/spring-cloud-static/Edgware.SR3/single/spring-cloud.html#_e ...

  2. 009-shiro与spring web项目整合【三】验证码、记住我

    一.验证码 1.自定义FormAuthenticationFilter 需要在验证账号和名称之前校验验证码 /** * * <p>Title: CustomFormAuthenticati ...

  3. cmd命令行和bat批处理操作windows服务(转载)

    一.cmd命令行---进行Windows服务操作 1.安装服务 sc create 服务名 binPath= "C:\Users\Administrator\Desktop\win32srv ...

  4. redis的ruby客户端(三)

    1. 介绍 clients这里列出了redis所支持的语言的所有客户端程序,其中就有ruby的.有这么多的客户端,说明要实现redis的客户端是不难的.其实你只要掌握一种语言的socket编程就可以实 ...

  5. golang redis的模式订阅

    c := redisPool.Get() psc := redis.PubSubConn{c} psc.PSubscribe("aa*") for { switch v := ps ...

  6. 在PC上调试微信手机页面的三种方法

    场景 假设一个手机页面,开发者对其做了限制,导致只能在微信客户端中打开.而众所周知手机上非常不利于调试页面,所以需要能在电脑上打开并进行调试.这里针对常见的三种页面做一下分析,一一绕过其限制,(当然不 ...

  7. MDK中One ELF Section per Function选项功能探究【转载】

    本文主要探讨的是MDK开发工具中One ELF Section per Function选项对于代码优化的作用及其实现的机制. 这里以EK-STM32F开发板的LCDDemo实验例程为例进行说明: 1 ...

  8. vue生命周期以及vue的计算属性

    一.Vue生命周期(vue实例从创建到销毁的过程,称为生命周期,共有八个阶段) 1.beforeCreate :在实例初始化之后,数据观测 (data observer) 和 event/watche ...

  9. 数据结构:JAVA实现二叉查找树

    数据结构:JAVA实现二叉查找树 写在前面 二叉查找树(搜索树)是一种能将链表插入的灵活性与有序数组查找的高效性结合在一起的一种数据结构. 观察二叉查找树,我们发现任何一个节点大于左子节点且小于其右子 ...

  10. Android 6.0 Kotlin 蓝牙扫描

    package com.arci.myapplication import android.app.Activityimport android.os.Bundleimport android.sup ...