A.HTML
<html> <head> <title> หน้าหลัก </title> <script language = "javascript" type = "text/javascript"> ฟังก์ชั่น OpenNew () {var im = idandMethod ใหม่ (); im.id = document.getElementById ("txtid") ค่า; window.showmodaldialog ("ddd.html", im, ""); } function idandmethod () {this.id = "ddd"; this.method = settxt; } function settxt (str) {document.getElementById ("txtid"). value = str; } </script> </head> <body> <form action = "#"> <input id = "txtid" type = "text" value = "xxx! ป้อน ID ที่นี่!" /> <br/> <อินพุต type = "button" value = "เปิดหน้าต่างใหม่" onclick = "openNew ()"/> </form> </body> </html>B.HTML
<html> <head> <title> หน้าหลัก </title> <ภาษาสคริปต์ = "javascript" type = "text/javascript"> var im; ฟังก์ชั่นโหลด () {im = window.dialogarguments; if (im.id == "xxx! ป้อน ID ที่นี่") document.getElementById ("txtid1"). value = "คุณจะป้อนมันไม่ว่าด้วยวิธีใด!"; Document.getElementById ("txtid1"). value = im.id; } function set () {im.method (document.getElementById ("txtid1") ค่า); } </script> </head> <body onload = "load ()"> <form action = "#"> <input id = "txtid1" type = "text" value = "ddd"/> <br/> <อินพุต type = "button" value = "pass data"