国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

子窗體與父窗體傳值示例js代碼

2024-05-06 15:49:45
字體:
供稿:網(wǎng)友
子窗體與父窗體之見互相傳值實現(xiàn)使用中很頻繁,本文以一個小示例拋磚引玉,希望大家可以舉一反三

復(fù)制代碼 代碼如下:


//返回值給父窗體
function returnParent(value) {//獲取子窗體返回值
var parent = window.dialogArguments; //獲取父頁面
//parent.location.reload(); //刷新父頁面
if (parent != null && parent != "undefined") {
window.returnValue = value; //返回值
window.close(); //關(guān)閉子頁面
}
//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中的內(nèi)容
if (hid != null && hid.length == 2) {
var i = 0;
if (hid[i] != "undefined" && hid[i] != "" && view[i + 1] != "undefined" && view[i + 1] != "") {
content += '<table><tr><td><img src="../../../Images/deleteimge.png" + 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("請只選擇一條數(shù)據(jù)。");
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");
}

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 金山区| 辰溪县| 五原县| 罗定市| 南江县| 弥渡县| 都昌县| 阳朔县| 西峡县| 靖宇县| 三门县| 建瓯市| 濮阳市| 嘉善县| 屏东市| 南江县| 肃南| 丹阳市| 耿马| 扬州市| 安丘市| 浮山县| 卓资县| 兴文县| 进贤县| 湘西| 阿巴嘎旗| 开平市| 梁山县| 兖州市| 南召县| 科技| 色达县| 孝昌县| 友谊县| 大埔县| 福泉市| 尼玛县| 浦东新区| 巢湖市| 榆树市|