分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

jQueryEasyUI Messager基本使用

发布时间:2023-09-06 01:09责任编辑:白小东关键词:jQuery

一、jQueryEasyUI下载地址

http://www.jeasyui.com/

二、jQueryEasyUI Messager基本使用

1、$.messager.alert(title, msg, icon, fn)
1>、基本用法

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>消息提示框</title>
<link href="/jquery-easyui-1.2.4/themes/default/easyui.css"rel="stylesheet"type="text/css"/>
<link href="/jquery-easyui-1.2.4/themes/icon.css"rel="stylesheet"type="text/css"/>
<script src="/jquery-easyui-1.2.4/jquery-1.6.4.min.js"type="text/javascript"></script>
<script src="/jquery-easyui-1.2.4/jquery.easyui.min.js"type="text/javascript"></script>
<script src="/jquery-easyui-1.2.4/locale/easyui-lang-zh_CN.js"type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.messager.alert("操作提示", "操作成功!");
});
</script>
</head>
<body>
</body>
</html>

效果图:

2>、icon使用
icon四种设置:"error"、"info"、"question"、"warning"
效果:

1
2
3
4
5
<script type="text/javascript">
$(function() {
$.messager.alert("操作提示", "操作成功!","info");
});
</script>
1
2
3
4
5
<script type="text/javascript">
$(function() {
$.messager.alert("操作提示", "操作失败!","error");
});
</script>
1
2
3
4
5
<script type="text/javascript">
$(function() {
$.messager.alert("操作提示", "您确定要执行操作吗!","question");
});
</script>
1
2
3
4
5
<script type="text/javascript">
$(function() {
$.messager.alert("操作提示", "您确定要执行操作吗!","warning");
});
</script>


3>、function使用

1
2
3
4
5
6
7
8
<script type="text/javascript">
$(function() {
$.messager.alert("操作提示", "操作成功!", "info", function() {
vari = 1;
alert(i);
});
});
</script>

2、$.messager.confirm(title, msg, fn)
代码:

1
2
3
4
5
6
7
8
9
10
11
12
<script type="text/javascript">
$(function() {
$.messager.confirm("操作提示", "您确定要执行操作吗?", function(data) {
if(data) {
alert("确定");
}
else{
alert("取消");
}
});
});
</script>

效果图:



3、$.messager.prompt(title, msg, fn)

代码:

1
2
3
4
5
6
7
8
9
<script type="text/javascript">
$(function() {
$.messager.prompt("操作提示", "您确定要执行操作吗?", function(data) {
if(data) {
alert(data);
}
});
});
</script>

效果图:



4、$.messager.show(options)
代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>消息提示框</title>
<link href="/jquery-easyui-1.2.4/themes/default/easyui.css"rel="stylesheet"type="text/css"/>
<link href="/jquery-easyui-1.2.4/themes/icon.css"rel="stylesheet"type="text/css"/>
<script src="/jquery-easyui-1.2.4/jquery-1.6.4.min.js"type="text/javascript"></script>
<script src="/jquery-easyui-1.2.4/jquery.easyui.min.js"type="text/javascript"></script>
<script src="/jquery-easyui-1.2.4/locale/easyui-lang-zh_CN.js"type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.messager.show({
title: "操作提示",
msg: "请选择您要删除的记录!",
showType: ‘slide‘,
timeout: 5000
});
});
</script>
</head>
<body>
</body>
</html>

1
2
3
4
5
6
7
8
9
10
11
<script type="text/javascript">
$(function() {
varoptions = {
title: "操作提示",
msg: "请选择您要删除的记录!",
showType: ‘slide‘,
timeout: 5000
};
$.messager.show(options);
});
</script>

效果图:


showType3种设置值:"show"、"slide"、"fade"

5、修改Button显示文字

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<script type="text/javascript">
$(function() {
$.messager.defaults = { ok: "是",
我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved