easyUI实现(alert)提示框自动关闭的实例代码
时间:2021-04-04 10:16:29|栏目:JavaScript代码|点击: 次
原理:使用js的定时任务函数setInterval设置时间,然后触发关闭事件
参数说明
title:提示框的标题
msg:提示信息内容
ico:显示的提示信息图标,'info','warnning','error'等
函数体
function alert_autoClose(title,msg,icon){
var interval;
var time=1000;
var x=2; //设置时间2s
$.messager.alert(title,msg,icon,function(){});
interval=setInterval(fun,time);
function fun(){
--x;
if(x==0){
clearInterval(interval);
$(".messager-body").window('close');
}
};
}
上一篇:JS实现侧悬浮浮动实例代码
栏 目:JavaScript代码
本文标题:easyUI实现(alert)提示框自动关闭的实例代码
本文地址:http://www.codeinn.net/misctech/94574.html






