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,