联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > 网页前端技术 > 正文

在次封装easyui-Dialog插件实现代码 - Web前端

作者:98wpeu发布时间:2026-06-11分类:网页前端技术浏览:3


导读:复制代码代码如下:$.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');}});
})

标签:插件代码WebDialogeasyui


网页前端技术排行
最近发表
网站分类
标签列表