我想通过调用函数在此对话框中创建一个带有按钮功能的对话框。但它不起作用。
我下面的代码//函数初始对话框
function inti_dlg(selector, autoOpen, height, width, modal, num_button, fn_apply, fn_cancel, fn_close)
{
if (num_button>1)
{
selector.dialog({
autoOpen: autoOpen,
height:height,
width:width,
modal:modal,
buttons:{
Apply:function(){fn_apply},
Cancel:function(){fn_cancel}
},
close:function(){fn_close}
});
}
else{
selector.dialog({
autoOpen: autoOpen,
height:height,
width:width,
modal:modal,
buttons:{
Apply:function(){fn_apply}
},
close:function(){fn_close}
});
}
}
//函数abc
function abc()
{
alert("abc");
}
// 调用初始对话框函数
$(function (){
inti_dlg($('#cde'), false, 440, 480, true, 1, abc(), '', abc());
$('#clickhere').click(function(){$('#cde').dialog('open');});
});
网页:
<div id="clickhere">Click here</div>
<div id="cde">
<div>Test : pass argument as a function</div>
</div>