在SharePoint2010的页面上,可以直接调用其弹出窗口的js方法,实现弹出窗口交互功能
直接上码吧
弹出窗口:
function openDialog(url, title) {
var options = {
url: url,
title: title,
width: 800,
dialogReturnValueCallback: feedbackReceived,
allowMaximize: true
};
SP.UI.ModalDialog.showModalDialog(options);
}
options 参数参考:http://technet.microsoft.com/zh-cn/library/ff410058
回调函数:
function feedbackReceived(dialogResult, returnValue) {
if (dialogResult == SP.UI.DialogResult.OK) {
//alert("保存成功!");
//重新加载iframe
ReloadIframe();
} else {
//alert("操作已取消!");
return false;
}
}
关闭窗口:
function HSClose(result) {
//result = 0 => 取消操作
//result = 1 => 操作成功
if (result == undefined) {
result = 0;
}
window.frameElement.commonModalDialogClose(result, '');
}
//function commonModalDialogClose(dialogResult,returnValue)
上图: