导航:首页 > 编程语言 > 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买车没有费用 浏览:691
win10怎样备份特定文件夹 浏览:623
合理利用网络你会有哪些行动 浏览:131
阿迪t格式文件 浏览:563
数据库模型数据模型 浏览:8
解压文件出现诊断信息 浏览:963
网站设计成本多少钱 浏览:699
姑娘学编程有什么用 浏览:339
谷歌app如何删除 浏览:118
注销微信支付实名 浏览:158
怎样把eps文件转化为ps源文件呢 浏览:767
宜家视频什么网站出来的 浏览:901
电脑微信保持东西不在文件夹 浏览:616
华为nova8pro怎么切换数据 浏览:658
qq怎么传文件到电脑Excel 浏览:927
z3735fwin改安卓 浏览:877
如何将筛选后的数据加填充颜色 浏览:100
wordpress去除分类目录归档 浏览:506
钱赚赚APP是如何实施诈骗的 浏览:383
广数如何编程循环钻孔 浏览:946

友情链接