復制代碼 代碼如下:
//返回值給父窗體
function returnParent(value) {//獲取子窗體返回值
var parent = window.dialogArguments; //獲取父頁面
//parent.location.reload(); //刷新父頁面
if (parent != null && parent != "undefined") {
window.returnValue = value; //返回值
window.close(); //關閉子頁面
}
//window.opener.document.getElementById("ActivityPic");//直接操作父窗體元素
//$(selector, window.parent.document);用於框架類頁面
//$(selector, window.opener.document);這個適合單獨打開的頁面
return;
}
//打開模式子窗體,獲取返回值進行操作
function showModalOnly(me, url) { //彈出窗體 ,單選
var hidden = document.getElementById(me); //獲取隱藏的控件
if (hidden != null && hidden.value != null && hidden.value.length > 0) {
alert("此處為單選,請先刪除已有的選項,再次嘗試選擇。");
return;
}
var reValue = window.showModalDialog(url, window, "dialogHeight:500px; dialogWidth:987px; status:off; scroll:auto");
if (reValue == null || reValue == "undefined" || reValue == "") {
return; //如果返回值為空,就返回
}
var index = reValue.split("^"); //分割符 ^ 的位置
if (index[0] == null || index[0] == "undefined" || index[0].length < 1) {
return;
}
var hid = index[0].split('&'); //為隱藏控件賦值
var view = index[1].split('&'); //顯示值
var content = ""; //需要添加到check中的內容
if (hid != null && hid.length == 2) {
var i = 0;
if (hid[i] != "undefined" && hid[i] != "" && view[i + 1] != "undefined" && view[i + 1] != "") {
content += '<table id="' + hid[i]
+ '" class="deleteStyle"><tr><td><img src="../../../Images/deleteimge.png" title="點擊刪除" alt="刪除" onclick=" deleteTable('
+ "'" + hid[i] + "'," + "'" + me + "'" + ');" /></td><td>' + view[i + 1] + '</td></tr></table>';
hidden.value = hid[i]; //為隱藏控件賦值
var c = document.getElementById("check" + me);
c.innerHTML += content;
return;
}
}
alert("請只選擇一條數據。");
return;
}
function openUploadWindow(url, width, height,left,top) {
if(width==null) width=987;
if (height == null) height = 500;
if (left == null) left = 200;
if (top == null) top = 200;
//window.open(url, 'newwindow', 'height=' + height + ',width=' + width + ',top=200,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
window.showModalDialog(url, window, "dialogHeight:" + height + "px; dialogWidth:" + width + "px;status:off; scroll:auto;dialogLeft:"+left+"px;dialogTop:"+top+"px");
}