自定义弹窗
使用jquery的$.dialog()方法可自定义弹窗
参数:
属性
title 窗口名称
html 内容显示传入的html代码
url 内容显示iframe,src为传入的ur
width 内容区宽度
height 内容区高度
buttons 数组:按钮及事件
buttons:[{
text: “确认”,
isEmphasize: true, //蓝色按钮
handler: function(){ alert(‘handler’) }
},{
text: “取消”,
handler: function(){ alert(‘handler’) }
}]
isDrag 是否允许拖拽
type 是’dialog’还是’panel’,默认为’dialog’
htmlId 显示改id内的内容
targetWindow 跨iframe显示[window.parent]注:window必须存在
closeParam 关闭按钮参数[show:是否显示关闭按钮,参数true or false],
[autoClose:点击关闭按钮是否自动关闭窗口,参数true or false],
[handler:点击关闭后调用的方法],默认值:{‘show’:true,handler:function(){}}
transParams 当url不为空时即弹出窗口中加载的是另外的窗口时,可以通过transParams传参数到弹出窗口中,在子页面中通过window.parentDialogObj[id]获取窗口对象,然后调用getTransParams()来获取传过来的参数
checkMax 检查弹出窗口是否超过浏览器可视区域
例:
dialog = $.dialog({
id:'formItem',
title:"系统提示",
content:"关键字不能包含特殊字符,请重新输入",
opacity:0.4,
width:300,
height:100,
buttons:[{
text:"确定",
isEmphasize:true,
handler:function(){
dialog.close();
}
}]
},
);