网络编程
位置:首页>> 网络编程>> JavaScript>> easyUI实现(alert)提示框自动关闭的实例代码

easyUI实现(alert)提示框自动关闭的实例代码

作者:jingxian  发布时间:2024-04-22 22:43:31 

标签:easyui,alert,关闭

原理:使用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');  
   }
};
}
0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com