部份programming language 寫function call 時可以支援default value, 可惜JavaScript不能. 故須要特別處理.
function alertDialog(message, title, okCallBack) { message=typeof message !== 'undefinded'? message: ""; title=typeof title!=='undefinded'? title: "Dialog"; okCallBack=typeof okCallBack!=='undefined'? okCallBack: function (dialogRef) { dialogRef.close(); }; BootstrapDialog.show({ title: title, message: message, buttons: [{ label: '<U>O</U>K', hotkey: 79, // Keycode of keyup event of key 'o' is 79. action: okCallBack }] }); }
Leave a Reply