SharePoint ShowModalDialog简单应用
<script type="text/javascript">
function OpenFrameDialog3(bid,hs,hname,xname) {
var options = SP.UI.$create_DialogOptions();
options.url = "/mypages/TestFirst.aspx?BID=" + bid + "&HS="+hs+"&HNAME="+hname+"&XNAME="+xname;
options.height = 500;
options.width = 950;
options.dialogReturnValueCallback = Function.createDelegate(null, CloseDialogCallback);
SP.UI.ModalDialog.showModalDialog(options);
}
function CloseDialogCallback(result, target) {
if (result === SP.UI.DialogResult.OK) {
javascript: setTimeout('javascript:return true;', 8000);
messageId = SP.UI.Notify.addNotification("<img src='_layouts/images/loading.gif'/>Creating list<b>" + target + "</b>");
}
if (result === SP.UI.DialogResult.cancel) {
SP.UI.Notify.addNotification("Operation was cancelled", false, "", null)
}
}
</script>
<a href="Javascript:OpenFrameDialog();">查看数据</a>
弹出页面:function OpenFrameDialog3(bid,hs,hname,xname) {
var options = SP.UI.$create_DialogOptions();
options.url = "/mypages/TestFirst.aspx?BID=" + bid + "&HS="+hs+"&HNAME="+hname+"&XNAME="+xname;
options.height = 500;
options.width = 950;
options.dialogReturnValueCallback = Function.createDelegate(null, CloseDialogCallback);
SP.UI.ModalDialog.showModalDialog(options);
}
function CloseDialogCallback(result, target) {
if (result === SP.UI.DialogResult.OK) {
javascript: setTimeout('javascript:return true;', 8000);
messageId = SP.UI.Notify.addNotification("<img src='_layouts/images/loading.gif'/>Creating list<b>" + target + "</b>");
}
if (result === SP.UI.DialogResult.cancel) {
SP.UI.Notify.addNotification("Operation was cancelled", false, "", null)
}
}
</script>
<a href="Javascript:OpenFrameDialog();">查看数据</a>
<html>
<head>
<script type="text/javascript">
//返回值方法
function ReturnPageValue() {
window.frameElement.commitPopup(document.getElementById('<%=txtValue.ClientID %>').value);
}
</script>
</head>
<body>
<input id="txtValue" type="text" runat="server" />
<input id="BtnOK" type="button" value="确定" onclick="ReturnPageValue();" />
<input id="BtnClose" type="button" value="关闭" onclick="window.frameElement.cancelPopUp();" />
</body>
</html>
<head>
<script type="text/javascript">
//返回值方法
function ReturnPageValue() {
window.frameElement.commitPopup(document.getElementById('<%=txtValue.ClientID %>').value);
}
</script>
</head>
<body>
<input id="txtValue" type="text" runat="server" />
<input id="BtnOK" type="button" value="确定" onclick="ReturnPageValue();" />
<input id="BtnClose" type="button" value="关闭" onclick="window.frameElement.cancelPopUp();" />
</body>
</html>