JavaScript opens a new window and gets the new window value

Source: Internet
Author: User

This article I have written before, is to click on a new window to do operations in a new window, and then the value of the use of JS Parent.iframe.formname.inputname.value so that the reality of the new page values. Here we summarize a few common methods.

Method One,

Main Page Open new Window JS event:

function Showmodelwindow () {
var itop = (window.screen.height-600)/2;
var ileft = (window.screen.width-500)/2;
var Reval = window.showmodaldialog (' basictype.asp tutorial x ',
' dialogheight:300px; Dialogwidth:100px;dialogtop: ' + itop + '; Dialogleft: ' + ILeft + '; edge:raised; Center:yes; Help:yes; Resizable:no; Status:yes;scroll:no; ');
if (typeof (Reval)!= ' undefined ') {form1.txtscd_type.value = Reval;} Take back the transfer value
}

New open Window OK button:

function Confirmback () {
Window.returnvalue = "value to return";
Window.close ();
}

Method Two,

Main Page Open new Window JS event:

function Showmodelwindow () {
var itop = (window.screen.availheight-510)/2; Gets the vertical position of the window;
var ileft = (window.screen.availwidth-650)/2; Get the horizontal position of the window;
window.open (' gethscodeinfo.aspx ', ', ' height=510px, width=650px, top= ' + Itop + ', left= ' + ILeft + ', toolbar=no,menubar= No, Scrollbars=yes, Resizable=no,location=no, Status=no ')
}

New open Window OK button:

function Confirmback (A, B, c) {
Window.opener.document.getelementbyid ("Txtcategory"). Value = A;
Window.opener.document.getelementbyid ("Txths_code"). Value = b;
Window.close ();
}

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.