Js example of the sub-form and parent form value passing operation

Source: Internet
Author: User
// Return value to the parent form functionreturnParent (value) {// obtain the return value of the child form varparentwindow. dialogArguments; // obtain the parent page // parent. location. reload (); // refresh the parent page if (parent! Null & amp; par...

 

// Return the value to the parent form
Function returnParent (value) {// obtain the return value of the child form
Var parent = window. dialogArguments; // obtain the parent page
// Parent. location. reload (); // refresh the parent page
If (parent! = Null & parent! = "Undefined "){
Window. returnValue = value; // Return value
Window. close (); // close the subpage
}
// Define your opener.doc ument. getElementById ("ActivityPic"); // directly operate the parent form Element

// $ (Selector, callback parent.doc ument); used for frame class pages
// $ (Selector, please specify opener.doc ument); this is a suitable page to be opened separately.
Return;
}

// Open the mode subform and obtain the return value.
Function showModalOnly (me, url) {// pop-up form, single choice
Var hidden = document. getElementById (me); // obtain the hidden Control
If (hidden! = Null & hidden. value! = Null & hidden. value. length> 0 ){
Alert ("this is a single choice. Please Delete the existing options and try again. ");
Return;
}
Var reValue = window. showModalDialog (url, window, "dialogHeight: 500px; dialogWidth: 987px; status: off; scroll: auto ");

If (reValue = null | reValue = "undefined" | reValue = ""){
Return; // If the returned value is null, return
}
Var index = reValue. split ("^"); // location of the delimiter ^
If (index [0] = null | index [0] = "undefined" | index [0]. length <1 ){
Return;
}
Var hid = index [0]. split ('&'); // assign a value to the hidden Control
Var view = index [1]. split ('&'); // display value
Var content = ""; // content to be added to check

If (hid! = Null & hid. length = 2 ){
Var I = 0;

If (hid [I]! = "Undefined" & hid [I]! = "" & View [I + 1]! = "Undefined" & view [I + 1]! = ""){

Content + =' + "'" + Hid [I] + "'," + "'" + me + "'" + '); "/>'+ View [I + 1] +'';

Hidden. value = hid [I]; // assign a value to the hidden Control
Var c = document. getElementById ("check" + me );
C. innerHTML + = content;
Return;
}
}
Alert ("select only one data entry. ");
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 ");
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.