Skulls using pop-up windows

xiaoxiao2021-03-06  47

In my practical application, I have a problem for my efforts to use JavaScript to pass the value to the parent window by pop-up window (Window.Open mode), and now I will finish these cases, and share with you Discussion.

1. Use JavaScript to pass the question mark "?" To the parent window, but the length limit of the URL address can only be within 255 characters. Write JavaScript code in an ONUNLOAD code in the pop-up window: Opener.document.location = Opener.document.location '? Id = 1 & type = 2'; if the URL address of the parent window is already the following code when it is already a query string : Opener.document.location = Opener.document.location '& id = 1 & Type = 2'; Take the value in the parent window: string id = request.queryString [ID "]; string type = request.QueryString ["Type"]; ... 2. Use JavaScript to assign a value to the control of the parent window. The code is as follows: Opener.Document.all.Text1.Value = 'value1'; Opener.Document.all.Text2.Value = 'value2'; ...... 3. When the data is large, use session, session can save There are many of the data types including classes, objects, etc., here, the DataSet class is used as the object, for example, illustrates. In the Page Unload event in the pop-up window, save the session, the code is as follows: Dataset DataSet1 = new dataset (); // do something ... session ["session1"] = DataSet1; Parent window Page Load Event (or other Take the value in the control event, the code is as follows: IF (session ["session1"]! = Null) {DataSet DataSet1 = (Dataset) session ["session1"]; // do something ...}

For the way to pop-up passages to the parent window, it may not only do this, but with these basic methods, in addition to the flexible penetration of the actual use, basically solve all problems.

转载请注明原文地址:https://www.9cbs.com/read-80049.html

New Post(0)