Home  >  Article  >  Web Front-end  >  js creates a child window and returns a value sample code_javascript skills

js creates a child window and returns a value sample code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:30:401202browse

Copy can be used directly, dear friends!

Copy code The code is as follows:

//Parent window
function onClick(){
var k = showModalDialog(
"view/WriteKey.jsp", contained page
"newwindow", fixed value
"dialogHeight:200px;
dialogWidth:400px; width
toolbar:no; whether there is a toolbar
menubar:no; whether there is a menu bar
scrollbars:no; scroll bar
resizable:no;
location:no ; Address bar
status:no; Status bar
left:100px;
top:100px;"); Alas, there are still two attributes I don’t remember, go to Baidu to download them.
//K is the value returned by the window
//Judge k
if(k!=null&&typeof(k)!=undefined){
..... ..........ok
}
}
//Sub window "view/WriteKey.jsp



JS part
function trans(tag){
var s=document.getElementById("dy").value document.getElementById("keyZ").value;
window.returnValue=s;
window.close();
}


ok, done,
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn