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

熱點內容
專題學習網站源碼 瀏覽:163
jsphead什麼 瀏覽:88
gps串口數據怎麼發送 瀏覽:968
win10文件主頁共享查看 瀏覽:411
中國聯通有哪些app是免流的 瀏覽:176
邊做邊保存的文件找不到了 瀏覽:858
win10照片應用文件夾名稱 瀏覽:966
編程如何解決資金的原子性 瀏覽:638
如何製作廣角鏡頭矯正文件 瀏覽:513
在網頁開發中應該選用哪個資料庫 瀏覽:742
iphone5移動卡貼 瀏覽:990
電腦文件的格式 瀏覽:127
extjs的xtype 瀏覽:959
suse11iso文件要u盤安裝 瀏覽:153
如何將報表統計數據轉化為圖形 瀏覽:444
如何寄快遞材料文件 瀏覽:265
java構造方法private 瀏覽:475
手機文件找回恢復 瀏覽:516
word怎麼把u盤里的文件拔掉 瀏覽:976
港版蘋果用的插排 瀏覽:1000

友情鏈接