您的位置:首页 > 产品设计 > UI/UE

在次封装easyui-Dialog 插件

2010-11-12 11:53 330 查看
$.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');}});})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: