导航:首页 > 编程语言 > 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跳转到首页代码相关的资料

热点内容
ps3文件分割视频 浏览:280
微信图片一键转发软件 浏览:331
如何判断s200plc编程电缆 浏览:691
太原编程培训班哪个好 浏览:171
树叶吹奏教程 浏览:6
社交app带来了哪些社会问题 浏览:394
如何安装爱宝8800数据采集器 浏览:712
文件保存了怎么找不到了 浏览:476
彩票网站怎么辨真假 浏览:840
pr找不到该文件 浏览:963
java移除panel 浏览:354
jsp填充jsp 浏览:166
海关外贸大数据在哪里查 浏览:381
思特奇java笔试题 浏览:121
葫芦侠在手机中的文件名 浏览:813
plc编程应该怎么收钱 浏览:584
c语言中源文件由什么组成 浏览:890
linuxhttpdphp配置文件 浏览:607
拆单数据要怎么保存 浏览:17
mac电脑怎样压缩文件到100m 浏览:645

友情链接