Bootstrap警告框(Alert)插件使用方法

作者:boonyaxnn 时间:2024-04-27 15:23:05 

有以下两种方式启用警告框的可取消(dismissal)功能:

1、通过 data 属性:通过数据 API(Data API)添加可取消功能,只需要向关闭按钮添加 data-dismiss="alert",就会自动为警告框添加关闭功能。

<a class="close" data-dismiss="alert" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" aria-hidden="true">&times;</a> 

2、通过 JavaScript添加可取消功能:

$(".alert").alert() 

html代码


<div class="alert alert-success">
  <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="close" data-dismiss="alert" aria-hidden="true">√</a>
  <strong>成功!</strong>您的网络连接已成功!
 </div>

效果图:

Bootstrap警告框(Alert)插件使用方法

3、下面是一些警告框(Alert)插件中有用的方法:

Bootstrap警告框(Alert)插件使用方法

效果图

Bootstrap警告框(Alert)插件使用方法

4、下表列出了警告框(Alert)插件中要用到的事件。这些事件可在函数中当钩子使用。

Bootstrap警告框(Alert)插件使用方法

html代码


<!DOCTYPE html>
<html>
<head>
 <title>Bootstrap 警告框(Alert)插件</title>
 <meta charset="utf-8">
 <link rel="stylesheet" href="css/bootstrap.min.css" rel="external nofollow" >  
 <script src="js/jquery.min.js"></script>
 <script src="js/bootstrap.min.js"></script>
 <style>
  body{
   font-size:24px;

}
 </style>
</head>
<body>
 <div class="container">
 <h3>警告框(Alert)插件 alert() 方法</h3>
 <div id="myAlert" class="alert alert-warning">
  <a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="close" data-dismiss="alert">×</a>
  <strong>警告!</strong>您的网络连接有问题。
 </div>
 <script type="text/javascript">
  $(function() {
  $("div#myAlert").bind('click',function () {
   alert("警告消息框被关闭。");
   });
  });
 </script>
 </div>

</body>
</html>

效果图:

Bootstrap警告框(Alert)插件使用方法

标签:Bootstrap,警告框,Alert
0
投稿

猜你喜欢

  • SQL语句中LEFT JOIN的ON和WHERE有什么区别

    2024-01-21 04:33:00
  • Python使用scrapy采集时伪装成HTTP/1.1的方法

    2023-07-07 01:28:40
  • python实现超级玛丽游戏

    2023-10-02 20:19:28
  • python时间日期操作方法实例小结

    2021-03-13 11:01:45
  • 详解Python requests模块

    2021-12-31 21:55:12
  • Django权限控制的使用

    2023-12-27 01:50:57
  • 解决Python pandas df 写入excel 出现的问题

    2021-07-27 15:37:21
  • mysql如何通过my.ini更改默认字符集

    2024-01-28 08:25:07
  • 快速掌握怎样选择准备安装的 MySQL版本

    2008-12-17 16:42:00
  • Python Pandas 对列/行进行选择,增加,删除操作

    2022-10-29 03:55:52
  • 基于PyQT5制作英雄联盟全皮肤下载器

    2023-07-03 15:54:08
  • PHP用mysql数据库存储session的代码

    2023-09-05 00:44:50
  • Div+CSS布局入门教程

    2007-09-13 12:52:00
  • Oracle11.2 命令行手工最简创建数据库的过程

    2009-09-14 12:07:00
  • python统计字符串中指定字符出现次数的方法

    2022-11-17 11:37:46
  • Python语言进阶知识点总结

    2022-11-09 01:21:37
  • Python3实现飞机大战游戏

    2022-08-25 05:29:03
  • Python正则抓取新闻标题和链接的方法示例

    2022-05-16 06:01:31
  • Python使用Phantomjs截屏网页的方法

    2022-06-17 15:47:14
  • Python大数据量文本文件高效解析方案代码实现全过程

    2023-01-18 04:57:01
  • asp之家 网络编程 m.aspxhome.com