JS window.showModalDialog

Source: Internet
Author: User

Window ShowModalDialog Content

(1) Parent page Open window

(2) parent page passing parameters to child page

(3) The child page gets the parameters passed by the parent page and returns a certain value.

Code:


function getHQ1 (option) {

Parent page passes parameters to a child page in 2 ways

 //           1) Add parameters and values directly to the URL. such as:/tbpweb/technology/institutionmanager/technologytextarea.jsp?opt=2

///2) var obj = new Object (); obj. Name = "QQ";

///3) var rowdata = window.showModalDialog (url, obj, "Dialogwidth:750px;dialogheight:250px;edge: Sunken;help:no;resizable:yes;scroll:no;status:no;unadorned:no ");


var url = "/tbpweb/technology/institutionmanager/technologytextarea.jsp?opt=2";

var num=math.random ();

var rowdata = window.showmodaldialog (url, window, "DIALOGWIDTH:750PX;DIALOGHEIGHT:250PX;EDGE:SUNKEN;HELP:NO; Resizable:yes;scroll:no;status:no;unadorned:no ");

if (typeof (RowData)! = "undefined") {

Get return value

var rowdata1=rowdata+ "";

var msg=rowdata1.split ("*");

var str=msg[1]+ "" +msg[2];

var strs=msg[0]+ "" +STR;

}

}

The child page gets the parent window pass parameter, and returns the information

1) Gets the parameter passed by URL:

$ (document). Ready (function () {

var href=window.location.href;

var hre= "";


if (href.split ("="). length==2) {

Hre=href.split ("=") [1];

if (Hre.split ("[email protected]"). length!= "")

Hre1=hre.replace (/[email protected]/g, "\ n");

Hre1=hre1.replace (/[email protected]/g, "=");

$ ("#hqyj"). Val (Hre1);

}

});

2) Gets the arguments passed by the object method:

$ (document). Ready (function () {

var obj = window.dialogarguments

var name = Obj.name;

});

3) The Sub-page returns information.

Window.returnvalue = "Apple * lychee";

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.