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

熱點內容
漫一網路培訓學校有哪些 瀏覽:752
酷狗app如何在電腦同步播放 瀏覽:668
雲浮微信群 瀏覽:344
公司文件打不開 瀏覽:267
LOL的設置文件在哪裡 瀏覽:254
線上開庭是什麼app 瀏覽:526
新中大軟體怎麼設置文件夾 瀏覽:807
git刪除文件夾 瀏覽:353
皇室戰爭怎麼升級競技場 瀏覽:447
雅虎統計工具 瀏覽:741
edgepdf文件分類 瀏覽:901
cad為什麼捕捉不到外部參照文件 瀏覽:935
重慶一共有多少個網站 瀏覽:34
k8s配置文件env創建失敗 瀏覽:197
編程序在電腦上叫做什麼 瀏覽:92
qq閱讀可賺 瀏覽:21
怎樣查找web儲存文件圖片 瀏覽:681
人口檔案資料庫包括什麼信息 瀏覽:709
手機有什麼好玩的星戰網路游戲 瀏覽:15
ps怎麼弄成轉曲文件 瀏覽:281

友情鏈接