導航:首頁 > 編程語言 > 404跳轉到首頁代碼

404跳轉到首頁代碼

發布時間:2024-09-02 16:12:49

1. 請問js代碼如何將網頁狀態碼設置為404,從而返回404頁面內容

js可以直接去獲取html,有一點要注意,需要通過http服務來訪問才行,不讓會有Failed to load錯誤。

<!doctypehtml>
<html>
<head>
<metacharset="utf-8">
<title></title>
<scripttype="text/javascript"src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<scripttype="text/javascript">
$(function(){
/*$('#goto404').click(function(){
$(document).find('body').html('404');
});*/
//第二種方法使用ajax-get
$("#goto404").click(function(){
$.get("404.html",function(htmls){alert(htmls)
$(document).find('body').html(htmls);
});
});
})
</script>
</head>
<body>
<inputtype="button"id="goto404"value="404">
<divid="scroll_div">
<divid="scroll_begin">
<ul>
<li>11111111</li>
<li>222222</li>
<li>3333</li>
<li>444444</li>
<li>55555555</li>
</ul>
</div>
</div>
<divid="scroll_end"></div>
</body>
</html>
閱讀全文

與404跳轉到首頁代碼相關的資料

熱點內容
陝西省產假158天規定文件在哪裡查 瀏覽:653
在哪個app買車沒有費用 瀏覽:691
win10怎樣備份特定文件夾 瀏覽:623
合理利用網路你會有哪些行動 瀏覽:131
阿迪t格式文件 瀏覽:563
資料庫模型數據模型 瀏覽:8
解壓文件出現診斷信息 瀏覽:963
網站設計成本多少錢 瀏覽:699
姑娘學編程有什麼用 瀏覽:339
谷歌app如何刪除 瀏覽:118
注銷微信支付實名 瀏覽:158
怎樣把eps文件轉化為ps源文件呢 瀏覽:767
宜家視頻什麼網站出來的 瀏覽:901
電腦微信保持東西不在文件夾 瀏覽:616
華為nova8pro怎麼切換數據 瀏覽:658
qq怎麼傳文件到電腦Excel 瀏覽:927
z3735fwin改安卓 瀏覽:877
如何將篩選後的數據加填充顏色 瀏覽:100
wordpress去除分類目錄歸檔 瀏覽:506
錢賺賺APP是如何實施詐騙的 瀏覽:383

友情鏈接