在次封装easyui-Dialog插件实现代码 - Web前端
作者:98wpeu发布时间:2026-06-11分类:网页前端技术浏览:7
导读:复制代码代码如下:$.fn.hDialog=function(options){vardefaults={width:300,height:200,ti...
复制代码 代码如下:
$.fn.hDialog = function (options) {
var defaults = {
width: 300,
height: 200,
title: '此处标题',
html: '',
iconCls: '',
submit: function () { alert('可执行代码.'); }
}
var id = $(this).attr('id');
options = $.extend(defaults, options);
var self = this;
$(self).dialog({
title: options.title,
height: options.height,
width: options.width,
iconCls: options.iconCls,
buttons: [{
text: '确定',
iconCls: 'icon-ok',
handler: options.submit
}, {
text: '取消',
iconCls: 'icon-cancel',
handler: function () {
$('#' + id).dialog('close');
}
}]
});
function createContent() {
$('.dialog-content',$(self)).empty().append('<div id="' + id + '_content" style="padding:5px;"></div>');
$('#' + id + "_content").HTML(options.html);
}
createContent();
}
调用:
复制代码 代码如下:
$(function(){
var d =$('<div id="d"></div>');
$('#d').hDialog({submit:function(){$(d).dialog('close');}});
})
$.fn.hDialog = function (options) {
var defaults = {
width: 300,
height: 200,
title: '此处标题',
html: '',
iconCls: '',
submit: function () { alert('可执行代码.'); }
}
var id = $(this).attr('id');
options = $.extend(defaults, options);
var self = this;
$(self).dialog({
title: options.title,
height: options.height,
width: options.width,
iconCls: options.iconCls,
buttons: [{
text: '确定',
iconCls: 'icon-ok',
handler: options.submit
}, {
text: '取消',
iconCls: 'icon-cancel',
handler: function () {
$('#' + id).dialog('close');
}
}]
});
function createContent() {
$('.dialog-content',$(self)).empty().append('<div id="' + id + '_content" style="padding:5px;"></div>');
$('#' + id + "_content").HTML(options.html);
}
createContent();
}
调用:
复制代码 代码如下:
$(function(){
var d =$('<div id="d"></div>');
$('#d').hDialog({submit:function(){$(d).dialog('close');}});
})
相关推荐
- jQuery学习笔记之jQuery的DOM操作 - Web前端
- 汉化英文版的Dreamweaver CS5并自动提示jquery - Web前端
- jQuery ajax serialize()方法的使用以及常见问题解决 - Web前端
- Jquery replace 字符替换实现代码 - Web前端
- Web开发者必备的12款超赞jQuery插件 - Web前端
- QUnit jQuery的TDD框架 - Web前端
- 使用FlexiGrid实现Extjs表格效果方法分享 - Web前端
- Javascript技巧之不要用for in语句对数组进行遍历 - Web前端
- 基于Jquery的动态添加控件并取值的实现代码 - Web前端
- jquery利用ajax调用后台方法实例 - Web前端
- 网页前端技术排行
- 最近发表
-
- WordPress随机显示特色图片插件:Random Post Thumbnails
- KeePass实现Chrome浏览器自动填充密码方法一
- LNMP一键包nginx 301强制跳转到https教程
- KeePass实现Chrome浏览器自动填充密码方法二
- #建站# 免费的VPS管理软件Xshell8/Xftp8中文版下载
- 使用Xshell 8连接VPS教程_电脑登录vps的方法
- WordPress评论界面添加烟花????效果
- 不同浏览器书签同步方案:坚果云+Floccus_详细使用教程
- iOS端KeePassXC客户端APP:Strongbox Password Safe
- 给WordPress评论中的Gravatar头像图片添加ALT属性


