js停止(阻止)瀏覽器繼續載入內容

來源:互聯網
上載者:User

標籤:style   blog   http   io   color   ar   os   sp   for   

  這個應該是一個比較特殊的要求,一般網站都沒有這個功能,對於一個新手來說,真的不知道從何處下手,只有在網上搜尋了,尋找現成答案,尋尋覓覓一天沒有結果。但是這個功能還是需要,第二天繼續網上大肆搜尋。終於功夫不負有心人,找到了。它的代碼很簡單,但是由於不熟悉這些基本功,無論如何也是不會的。現在把它摘抄過來,給自己一個筆記。以便下次之需。

function CloseSearch() {        $("#searchEffect").html(searchEffect);        var xmlhttp;        if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari            xmlhttp = new XMLHttpRequest();        }        else {// code for IE6, IE5            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");        }        xmlhttp.abort();        mystop();        //alert("dddd");    }    function mystop() {        if (!!(window.attachEvent && !window.opera))        { document.execCommand("stop"); }        else        { window.stop(); }    }

是不是真的很簡單。效果如何只有實際操作檢驗才知道。試試吧!

js停止(阻止)瀏覽器繼續載入內容

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.