所属分类:网页特效-对话框/灯箱/提示,悬浮层/弹出层
<link rel="stylesheet" href="BeAlert.css">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script src="BeAlert.js"></script>
$(function () {
$("#alert").click(function () {
alert("Hello world!", "welcome to my world :)", function () {
//after click the confirm button, will run this callback function
}, {type: 'success', confirmButtonText: 'OK'});
});
$("#confirm").click(function () {
confirm("Are you sure?", "You will not be able to recover this imaginary file!", function (isConfirm) {
if (isConfirm) {
//after click the confirm
} else {
//after click the cancel
}
}, {confirmButtonText: 'Yes, delete it!', cancelButtonText: 'No, cancel plx!', width: 400});
});
});
<h2><a href="javascript:;" id="alert">Alert</a></h2>
<h2><a href="javascript:;" id="confirm">Confirm</a></h2>
alert(title,message,callback,config);
confirm(title,message,callback,config);
参数 | 默认值 | 描述 |
---|---|---|
title | null | 标题 |
message | null | 内容 |
callback | null | 回调函数 |
config | null | 配置参数: width: 宽度, height: 最小高度, type: 'warning'|'error'|'success'|'info'|'question', showConfirmButton: 是否显示确认按钮, showCancelButton: 是否显示取消按钮, confirmButtonText: '确认', cancelButtonText: '取消' |