`
j1a1v1a1
  • 浏览: 28604 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

bootstrap 样式下 Se7en 模板使用(1)操作提示信息框

 
阅读更多

代码中引用 js

<!-- 提示信息  start-->

<script src="<%=basePath%>static/javascripts/sweetalert-dev.js" type="text/javascript"></script>

<!-- 提示信息  end-->

实际项目中代码例子:

 

 //删除
	 function delRow(id){
	 		  swal({
                  title: "您确定要删除吗?",
                  text: "您确定要删除这条数据?",
                  type: "warning",
                  showCancelButton: true,
                  closeOnConfirm: false,
                  animation: "slide-from-top",
                  cancelButtonText: "取消",
                  confirmButtonText: "是的,我要删除",
                  confirmButtonColor: "#ec6c62"
              }, function() {
            	  ajax.callhz(
              			"${pageContext.request.contextPath}/user/del",
              			 {Id:  id},
              			function(datas, status){
              				if(datas.errorCode ==0){//成功
              					if(datas.data.length >0){
              						var count = datas.data[0].count;
              						 // swal("操作成功!", "已成功删除:"+count+"条数据!", "success");
              						 swal({
             		                       title: "操作成功!",
             		                       text: "已成功删除:"+count+"条数据!",
             		                       animation: "slide-from-top",
             		                       type: "success", 
             		                       html: true,
             		                       timer: 3000
             		                 	 });  
              					}
              				}else{
              					swal("warning", "删除操作失败了!", "error");
              				}
              			},
              			function( textStatus, errorThrown){}); 	
            	  
                
              });
	 	}

 swal API 方法

 

参数 描述 默认值
title 提示框标题 -
text 提示内容 -
type 提示类型,有:success(成功),error(错误),warning(警告),input(输入)。 -
showCancelButton 是否显示“取消”按钮。 设置中文名字:cancelButtonText: "取消", -
animation 提示框弹出时的动画效果,如slide-from-top(从顶部滑下)等 -
html 是否支持html内容。 -
timer 设置自动关闭提示框时间(毫秒)。 -
showConfirmButton 是否显示确定按钮。 -
confirmButtonText 定义确定按钮文本内容。 -
imageUrl 定义弹出框中的图片地址。

有需要留言 沟通

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics