温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

jQuery easyui(1)——消息框(message)

发布时间:2020-08-11 06:33:18 来源:网络 阅读:1568 作者:划破手 栏目:web开发

没事学习下jQuery easyui,顺便记录下来,并分享下。当然,初学不免有不当的地方,欢迎大家指正……

   首先了解下jQuery中的消息框,在写jquery代码前,需要做一些准备工作,如:下载jQuery easyui包,解压并将相关的js、css文件引入到html文件,主要用到的css文件有

<link rel="stylesheet" href="../css/easyui.css"type="text/css">

<link rel="stylesheet" href="../css/icon.css" type="text/css">

主要用到的js文件有:

<script type="text/javascript" src="../js/jquery.min.js"></script>

<script type="text/javascript" src="../js/jquery.easyui.min.js"></script>

    下面一起看下jQuery easyui中的一些消息框主要有四种,它们之间都很相似:

$.messager.alert(
"my message",         //title  消息框标题
"this is content...", //msg 消息框内容
"info",               // icon 图标,取值:error,question,info,warning.
function(){           //消息框关闭后调用的函数
   alert("function");
});
$.messager.show({
title:"title",
width:600,
height:300,
msg:"messager.show",
showType:"fade", //显示方式:可取的值 null,slide(默认值),fade,show
showSpeed:600,   //显示速度:默认600ms
style:{         //显示的位置
    right:'',
    bottom:'',
    top:0
},
timeout:3000,        //多长时间后消失,毫秒为单位
draggable:true
});
// 下面两个消息框与message.alert十分相似,只是回调函数有所不同
//confirm的回调函数带布尔类型的参数,promp消息框中有文本框
 $.messager.confirm(
                "this is title",
                "this is msg",
                function(xx){
                          if(xx)
                               alert(xx);
                           else
                               alert(xx);
});
$.messager.prompt(
        "this is title",
        "this is msg",
        function(content){
                 if(content)
                    alert(content+" ok");
                 else
                     alert("cancel");
});

    记录并分享,欢迎大家指正……

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI