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

熱點內容
核桃編程如何讓僵屍往前移動 瀏覽:96
移動卡不能用聯通網路 瀏覽:663
對啊網免費視頻教程 瀏覽:837
ev錄屏的文件找不到了是什麼原因 瀏覽:36
編程貓人物怎麼鏡面翻轉 瀏覽:901
怎麼在迷你編程裡面換皮膚 瀏覽:757
ps查找文件屬性 瀏覽:739
s6edge網路設置 瀏覽:563
視頻網站ip怎麼獲得 瀏覽:944
java循環嵌套題目 瀏覽:404
stc15頭文件 瀏覽:775
java後台傳前台亂碼 瀏覽:807
織夢cms空間安裝教程 瀏覽:107
打開的文件在哪裡保存 瀏覽:212
webstorm運行angularjs 瀏覽:509
海馬ipad2描述文件在哪裡 瀏覽:535
bts文件 瀏覽:211
可以看自拍的app 瀏覽:374
html引用js變數 瀏覽:535
酷派手機升級助手 瀏覽:897

友情鏈接