子窗體與父窗體傳值示例js代碼
//返回值給父窗體
function returnParent(value) {//獲取子窗體返回值
var parent = window.dialogArguments; //獲取父頁(yè)面
//parent.location.reload(); //刷新父頁(yè)面
if (parent != null && parent != "undefined") {
window.returnValue = value; //返回值
window.close(); //關(guān)閉子頁(yè)面
}
//window.opener.document.getElementById("ActivityPic");//直接操作父窗體元素
//$(selector, window.parent.document);用于框架類頁(yè)面
//$(selector, window.opener.document);這個(gè)適合單獨(dú)打開的頁(yè)面
return;
}
//打開模式子窗體,獲取返回值進(jìn)行操作
function showModalOnly(me, url) { //彈出窗體 ,單選
var hidden = document.getElementById(me); //獲取隱藏的控件
if (hidden != null && hidden.value != null && hidden.value.length > 0) {
alert("此處為單選,請(qǐng)先刪除已有的選項(xiàng),再次嘗試選擇。");
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 id="' + hid[i]
+ '" class="deleteStyle"><tr><td><img src="../../../Images/deleteimge.png" title="點(diǎn)擊刪除" 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("請(qǐng)只選擇一條數(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");
}
相關(guān)文章
JavaScript中數(shù)組雙重去重的方法總結(jié)
這篇文章主要為大家學(xué)習(xí)介紹了JavaScript中數(shù)組雙重去重的幾個(gè)常用方法,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2023-07-07ymPrompt的doHandler方法來(lái)實(shí)現(xiàn)獲取子窗口返回值的方法
今天在寫頁(yè)面時(shí)用到了ymPrompt的win方法來(lái)彈出一個(gè)窗口。由于要用到獲取子窗口返回來(lái)的值判斷是否刷新父窗口,在ymPrompt的組件Demo中一直沒有找到合適的方法實(shí)現(xiàn)2010-06-06使用JS實(shí)現(xiàn)圖片展示瀑布流效果的實(shí)例代碼
下面小編就為大家?guī)?lái)一篇使用JS實(shí)現(xiàn)圖片展示瀑布流效果的實(shí)例代碼。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-09-09BootstrapTable與KnockoutJS相結(jié)合實(shí)現(xiàn)增刪改查功能【二】
這篇文章主要介紹了BootstrapTable與KnockoutJS相結(jié)合實(shí)現(xiàn)增刪改查功能【二】的相關(guān)資料,非常具有參考價(jià)值,感興趣的朋友一起學(xué)習(xí)吧2016-05-05JavaScript URL參數(shù)讀取改進(jìn)版
此前發(fā)表的那一版確實(shí)能不用循環(huán),但是總用正則表達(dá)式的替換,不一定比用循環(huán)提高性能,而且把程序搞得有些太復(fù)雜了。從《JavaScript權(quán)威指南》上學(xué)到的范例如下2009-01-01基于JavaScript短信驗(yàn)證碼如何實(shí)現(xiàn)
我們?cè)谑褂靡苿?dòng)、電信等運(yùn)營(yíng)商網(wǎng)上營(yíng)業(yè)廳的時(shí)候,為確保業(yè)務(wù)的完整和正確性,經(jīng)常會(huì)需要用到短信的驗(yàn)證碼。最近因?yàn)槟呈I(yè)務(wù)需要,也做了個(gè)類似的功能2016-01-01關(guān)于bootstrap日期轉(zhuǎn)化,bootstrap-editable的簡(jiǎn)單使用,bootstrap-fileinput的
這篇文章主要介紹了關(guān)于bootstrap日期轉(zhuǎn)化,bootstrap-editable的簡(jiǎn)單使用,bootstrap-fileinput的使用,需要的朋友可以參考下2017-05-05