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

热点内容
2017互联网java面试题 浏览:907
供求网站源码 浏览:195
童程童美编程加盟怎么样 浏览:895
app美团如何下载 浏览:197
弄画框用什么app 浏览:814
java获取网页图片 浏览:193
jsp集合对象转json 浏览:231
文件柜在cad里面长啥样 浏览:554
iphone手机文件保存在哪里 浏览:817
解压文件后要刷新 浏览:786
cc数据库怎么获得时间 浏览:226
ug3d硬料开出怎么编程 浏览:151
如何获取文件Linux命令 浏览:981
大智慧软件哪个版本最好 浏览:698
狼人杀自动主持app叫什么 浏览:949
checkbox怎么绑定数据库 浏览:945
编程怎么设置一分钟开灯 浏览:754
如何把桌面文件发送到自己邮箱 浏览:498
校园网站怎么看选修的课 浏览:59
大数据专业哪个最好 浏览:467

友情链接