導航:首頁 > 編程語言 > 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跳轉到首頁代碼相關的資料

熱點內容
win10文件比率是什麼 瀏覽:652
msdb資料庫置疑 瀏覽:210
移動花卡免流app為什麼要10元 瀏覽:147
xamppphp配置文件 瀏覽:268
刪除ghost文件 瀏覽:642
蘋果7可置換地方 瀏覽:763
win10騰訊文件夾在哪裡 瀏覽:262
在網站前面加什麼可以看會員視頻 瀏覽:908
哪個讀書app支持格式最全 瀏覽:322
魅族mx3提示網路可能會受到監控 瀏覽:308
如何判斷復制文件是否完整 瀏覽:803
qq接收的語音文件在 瀏覽:408
手機qq禁止查看動態 瀏覽:923
如何用編程求解二重積分 瀏覽:366
在桌面上搜索不到文件夾 瀏覽:723
中外文專利網站有哪些 瀏覽:682
尖刀車端面槽怎麼編程 瀏覽:70
電腦重裝會把所有文件都刪掉嗎 瀏覽:982
java匿名內部類構造函數 瀏覽:573
如何ftp文件到linux 瀏覽:894

友情鏈接