JS實(shí)現(xiàn)關(guān)閉當(dāng)前頁(yè)而不彈出提示框的方法

字號(hào):


    本文實(shí)例講述了JS實(shí)現(xiàn)關(guān)閉當(dāng)前頁(yè)而不彈出提示框的方法。分享給大家供大家參考,具體如下:
    關(guān)閉當(dāng)前頁(yè)面,并且打開(kāi)新頁(yè)面(不提示)
    function closeWinAndOpen(url) {
      var sWinName = "LR"+parseInt(Math.random() * 100000000);//利用隨機(jī)數(shù)處理WinName
      window.open(url,sWinName, 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes');
      closeWin();
    }
    關(guān)閉當(dāng)前頁(yè)面:
    function closeWin() {
      window.opener=null;
      window.open('','_self');
      window.close();
    }
    關(guān)閉父頁(yè)面:
    代碼如下:
    Response.Write("<script>window.top.opener=null;window.parent.close();</script>")
    希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。