この記事では、JSがウィンドウを閉じるときに生成されたイベントと使用法について説明します。次のように、参照のために共有してください。
/******************ウィンドウを閉じて評価を閉じて送信******************/window.onbeforeunload = function(){var pagewidth = math.document.body.scrollwidth、window.top.document.documentelement.scrollwidth); var pageheight = math.max(window.top.document.body.scrollheight、windop.top.document.documentelement.scrollheight); var cltheight = math.max(window.top.document.body.clientheight、windop.top.document.documentelement.clientheight); var width = 400; var height = 200; var layer = windop.top.document.getelementbyid( "zz_layer"); if(layer!= null){layer.parentnode.removechild(layer); } //マスクレイヤーvar layer = windop.top.document.createelement( "div"); layer.id = "zz_layer"; layer.style.filter = "alpha(ofacity = 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.left = 0; layer.style.backgroundcolor = "#000"; layer.style.zindex = "9998"; window.top.document.body.appendchild(layer); //評価ウィンドウvar newbox = document.getElementById( "kf_pj_div"); newbox.style.zindex = "9999"; newbox.style.display = "block"; newbox.style.width = width + "px"; newbox.style.height = height + "px"; newbox.style.border = "#565656 4px solid"; newbox.style.background = "#ffffff"; newbox.style.position = "absolute"; newbox.style.left = pageWidth/2 + "px"; newbox.style.top =(cltheight/2) + "px"; if(height/2>(cltheight/2)){newbox.style.margintop =( - (cltheight/2)) + "px"; } else {newbox.style.margintop =( - height/2) + "px"; } if(width/2>(pagewidth/2)){newbox.style.marginLeft =( - (pageWidth/2)) + "px"; } else {newbox.style.marginLeft =( - width/2) + "px"; }「カスタマーサービスについてまだコメントしていない」を返します。「キャンセル」評価をクリックしてください!」; }; function mydiv_resize(){var pagewidth = math.max(window.top.document.body.scrollwidth、windop.top.document.documentlement.scrollwidth); var pageheight = math.max(window.top.document.body.scrollheight、windop.top.document.documentelement.scrollheight); var cltheight = math.max(window.top.document.body.clientheight、windop.top.document.documentelement.clientheight); var cltwidth = math.max(window.top.document.body.clientwidth、windop.top.document.documentelement.clientwidth); var width = 400; var height = 200; var layer = windop.top.document.getelementbyid( "zz_layer"); if(layer!= null){// mask layer layer.style.width = pagewidth + "px"; layer.style.height = pageheight + "px"; } //評価ウィンドウvar newbox = document.getElementById( "kf_pj_div"); newbox.style.left = cltwidth/2 + "px"; newbox.style.top =(cltheight/2) + "px"; if(height/2>(cltheight/2)){newbox.style.margintop =( - (cltheight/2)) + "px"; } else {newbox.style.margintop =( - height/2) + "px"; } if(width/2>(pagewidth/2)){newbox.style.marginLeft =( - (pageWidth/2)) + "px"; } else {newbox.style.marginLeft =( - width/2) + "px"; }} window.onresize = mydiv_resize;JavaScript関連のコンテンツの詳細については、このサイトのトピックをご覧ください:「JavaScriptウィンドウの操作とスキルの要約」、「javascriptのJSON操作スキルの概要」、「JavaScript Switching javascript Search Algorithmスキルの概要」、「Javascript Animation special Effects and mavascritturits "javascriptエラーとスキルの概要を確認してください。 JavaScriptトラバーサルアルゴリズムとスキルの "および" JavaScript数学操作の使用概要の概要
この記事がみんなのJavaScriptプログラミングに役立つことを願っています。