Js: Create a subwindow and return the value. Example code _ javascript skills

Source: Internet
Author: User
This article gives you a detailed example of using js to create a subwindow and return a value. If you are interested, refer to the example below. We hope you can use Copy directly!

The Code is as follows:


// Parent window
Function onClick (){
Var k = showModalDialog (
"View/WriteKey. jsp", included page
"Newwindow", fixed values
"DialogHeight: 200px;
DialogWidth: 400px; Width
Toolbar: no; whether a toolbar exists
Menubar: no; whether the menu bar exists
Scrollbars: no; scroll bar
Resizable: no;
Location: no; Address Bar
Status: no; status Bar
Left: 100px;
Top: 100px; "); alas there are two other attributes that you don't remember. Go to the next level.
// K is the return value of the window.
// Judge k
If (k! = Null & typeof (k )! = Undefined ){
.......... OK
}
}
// Subwindow "view/WriteKey. jsp



JS Section
Function trans (tag ){
Var s = document. getElementById ("dy"). value + document. getElementById ("keyZ"). value;
Window. returnValue = s;
Window. close ();
}


OK, finished,
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.