Este artículo describe los eventos y usos generados cuando JS cierra una ventana. Compártelo para su referencia, como sigue:
/******************** Cierre la ventana y envíe la evaluación ******************/Window.onbeforeunload = function () {var PageWidth = Math.max (window.top.document.body.scrollwidth, window.top.document.documentelement.scrollwidth); var pageHeight = Math.max (window.top.document.body.scrollheight, window.top.document.documentelement.scrollheight); var cltheight = math.max (window.top.document.body.clientheight, window.top.document.documentelement.clientheight); ancho var = 400; altura var = 200; var layer = window.top.document.getElementById ("zz_layer"); if (layer! = null) {layer.parentnode.removechild (capa); } // máscara de capa var layer = window.top.document.createElement ("div"); Layer.id = "ZZ_LAYER"; Layer.Style.Filter = "Alpha (Opacidad = 38)"; // IE Layer.Style.Opacity = "0.38"; // ff Layer.Style.Width = PageWidth + "Px"; Layer.Style.Height = PageHeight + "Px"; Layer.Style.Position = "Absolute"; Layer.style.top = 0; Layer.Style.Ltft = 0; Layer.Style.BackgroundColor = "#000"; Layer.style.zindex = "9998"; window.top.document.body.appendchild (capa); // Ventana de evaluación var newbox = document.getElementById ("KF_PJ_DIV"); newbox.style.zindex = "9999"; newbox.style.display = "bloque"; newbox.style.width = ancho + "Px"; newbox.style.Height = altura + "Px"; newbox.style.border = "#565656 4px sólido"; newbox.style.background = "#ffffff"; newbox.style.position = "Absolute"; newbox.style.left = PageWidth/2 + "Px"; newbox.style.top = (cltheight/2) + "px"; if (altura/2> (cltheight/2)) {newbox.style.margIntop = ( - (cltheight/2)) + "px"; } else {newbox.style.margIntop = ( - altura/2) + "Px"; } if (width/2> (pageWidth/2)) {newbox.style.Marginleft = ( - (PageWidth/2)) + "Px"; } else {newbox.Style.Marginleft = ( - Width/2) + "Px"; } Devolver "No ha comentado sobre el servicio al cliente todavía, haga clic en 'Cancelar' Calificación!"; }; function myDiv_Resize () {var PageWidth = Math.max (window.top.document.body.scrollwidth, window.top.document.documentelement.scrollwidth); var pageHeight = Math.max (window.top.document.body.scrollheight, window.top.document.documentelement.scrollheight); var cltheight = math.max (window.top.document.body.clientheight, window.top.document.documentelement.clientheight); var cltwidth = math.max (window.top.document.body.clientwidth, window.top.document.documentelement.clientwidth); ancho var = 400; altura var = 200; var layer = window.top.document.getElementById ("zz_layer"); if (layer! = null) {// Mask Capa Layer.style.width = PageWidth + "Px"; Layer.Style.Height = PageHeight + "Px"; } // Ventana de evaluación var newbox = document.getElementById ("KF_PJ_DIV"); newbox.style.left = cltwidth/2 + "px"; newbox.style.top = (cltheight/2) + "px"; if (altura/2> (cltheight/2)) {newbox.style.margIntop = ( - (cltheight/2)) + "px"; } else {newbox.style.margIntop = ( - altura/2) + "Px"; } if (width/2> (pageWidth/2)) {newbox.style.Marginleft = ( - (PageWidth/2)) + "Px"; } else {newbox.Style.Marginleft = ( - Width/2) + "Px"; }} window.onresize = myDiv_Resize;Para obtener más información sobre el contenido relacionado con JavaScript, consulte los temas de este sitio: "Operación de la ventana de JavaScript y resumen de habilidades", "Resumen de habilidades de operación JSON en JavaScript", "JavaScript Switching Efectos especiales y habilidades de habilidades de JavaScript Search ALGORITM SKABLES", "ESTICUROS DE ALTENIMACIÓN DE ALIGRITURA DE JAVASITURA. de JavaScript Algoritmo y habilidades de traversal "y" JavaScript Mathematical Operation Usage Resumen de
Espero que este artículo sea útil para la programación de JavaScript de todos.