Window.showmodaldialog는 모드 창을 팝업하는 방법입니다.
ReturnValue는 JavaScript의 HTML Window 개체의 속성입니다. 목적은 창 값을 반환하는 것입니다. Window.showmodaldialog 함수 IE 모드 창을 열기 위해 (모드 창을 알고 있습니다. 예는 다음과 같습니다.
1. Parent.html
//father.html <html> <head> <meta name = "generator"content = "Microsoft Visual Studio 6.0"> <title> </title> <script language = "javaScript"> function showmodal () {var ret = Window.showmodaldialog ( "child.htm", null, "dialogwidth : 350px; dialogheight : 350px; 도움말 : 아니오; 상태 : 아니오"); if (ret) {alert ( '하위 창자는 true!'); } else {alert ( '하위 윈도는 false!'); }}} </script> </head> <body> <입력 ID = button1 유형 = 버튼 값 = 버튼 이름 = button1 onclick = "showmodal ();"> </body> </html>2. child.html
//child.html <html> <head> <meta name = "generator"content = "Microsoft Visual Studio 6.0"> <title> </title> <script language = "javaScript"> function trans (tag) {if (tag == 0) {window.returnvalue = false; } else {window.returnValue = true; } window.close (); }.요약 :
이런 식으로, 모드 창에서 부모 창으로 값을 전달하는 기능을 실현할 수 있습니다. 부울 값, 정수 값 등 외에도이 returnValue는 JS 배열 일 수도 있으며, 이는 많은 양의 데이터를 전달하는 데 사용됩니다.
Showmodaldialog의 구체적인 사용은 MSDN을 참조하십시오.