子表單與父表單傳值樣本js代碼

來源:互聯網
上載者:User

複製代碼 代碼如下:
//傳回值給父表單
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");
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.