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

熱點內容
電信營業廳app怎麼查詢uk碼 瀏覽:282
ls可編程式控制制器如何使用 瀏覽:388
擴展名為的文件是視頻文件 瀏覽:761
如何安裝my配置文件 瀏覽:324
卡死安卓機代碼 瀏覽:127
mt4畫的線屬於什麼文件 瀏覽:568
輸入文件格式 瀏覽:103
織夢網站一排4張圖片 瀏覽:301
樂1s可以升級到全網通嗎 瀏覽:484
QQ瀏覽器保留密碼mac 瀏覽:761
一台電腦如何共享文件夾 瀏覽:942
wps如何保存pdf文件 瀏覽:602
PS源文件是厘米 瀏覽:766
創建桌面文件夾路徑 瀏覽:900
華為手機app應用數據哪些刪除 瀏覽:765
資料庫有哪些表格 瀏覽:741
bada12微信java 瀏覽:16
小白編程什麼最好學 瀏覽:205
qq回頭看頭像 瀏覽:338
蘋果換屏要多長時間 瀏覽:283

友情鏈接