ห่อหุ้มหน้าต่างเปิดเพื่อให้มีประโยชน์มากขึ้นและเข้ากันได้มากขึ้น หลายคนบอกว่า Window.Open ไม่เข้ากัน แต่ไม่ใช่เพราะไม่สามารถดำเนินการได้โดยตรงและต้องถูกเรียกใช้ด้วยตนเองโดยผู้ใช้ ดูรหัส:
รหัสมีดังนี้
var openWindow = function (url, ตัวเลือก) {var str = ""; ถ้า (ตัวเลือก) {opotions.height = opotions.height || 420; opotions.width = opotions.width || 550; opotions.left = opotions.left || ((screen.width - opotions.width) / 2); // ค่าเริ่มต้นเป็นตัวเลือกที่อยู่ตรงกลาง top = opotions.top || ((screen.height - opotions.height) / 2); // ค่าเริ่มต้นอยู่กึ่งกลางสำหรับ (var i ในตัวเลือก) {str + = ',' + i + '=' + ตัวเลือก [i];} str = str.substr (1);}; window.open (url, 'connect_window _' + วันที่ใหม่) เว็บไซต์ document.body.onclick = function () {openwindow ("http://www.daermay.com/? rel = xuexb");} // ตัวอย่าง 2: ความกว้างคงที่และเอกสารตรงกลาง