web建站教程

  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. php入门
    nodejs
    mockjs
    mysql
    织梦cms
    帝国cms
    git教程

当前页面错误,5秒钟自动关闭当前页面

193 ℃

下面web建站教程为大家介绍一下当前页面错误,5秒钟自动关闭当前页面

<!DOCTYPE html>
<html>
  <head>
  	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  	<meta name="apple-touch-fullscreen" content="yes" />
  	<meta name="apple-mobile-web-app-capable" content="yes" />
  	<meta name="apple-mobile-web-app-status-bar-style" content="black" />
  	<meta name="format-detection" content="telephone=no" />
  	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  	<meta http-equiv="Cache-Control" content="no-transform" />
  	<meta http-equiv="Cache-Control" content="no-siteapp" />
  	<title>温馨提示</title>
  	<style>
  	  .trips {
  	  	width: 400px;
  	  	text-align: center;
  	  	border: 1px solid #ddd;
  	  	border-radius: 5px;
  	  	position: absolute;
  	  	left: 50%;
  	  	top: 50%;
  	  	transform: translate(-50%, -50%);
  	  }
	  
  	  .trips h4 {
  	  	height: 35px;
  	  	line-height: 35px;
  	  	margin: 0;
  	  	padding: 0;
  	  	background: #f5f5f5;
  	  	border-bottom: 1px solid #ddd;
  	  	border-radius: 5px 5px 0 0;
  	  }
  	</style>
  </head>
  <body>
  	<div class="trips">
  	  <h4>温馨提示</h4>
  	  <p>当前页面不存在!</p>
  	  <p style="font-size: 13px;"><i id="time" style="color: #f00; font-style: normal;">5</i>&nbsp;秒后自动关闭页面</p>
  	</div>
  	<script type="text/javascript">
  	  window.setInterval("countDown()", 1000);
  	  function countDown() {
  	  	var time = document.getElementById("time");
  	  	if (time.innerHTML == 0) {
  	  		window.close()
  	  	} else {
  	  		time.innerHTML = time.innerHTML - 1;
  	  	}
  	  }
  	</script>
  </body>
</html>

上面是“当前页面错误,5秒钟自动关闭当前页面”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_2143.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

js把数组里数据用另一个数组的替换(通过相同

1、对象替换


var arr1 = [
    { id: 100, name: '小麦', value: "1" },
    { id: 101, name: '小明', value: "2" },
    { id: 102, name: '小白', value: "3" },
    { id: 103, name: '小青', value: "4" },
    { id: 104, name: '小龙', value: "5" },
];
var arr2={id:102,name:'小龙虾',value:"100"}; 
arr1 = arr1.map(t => {
    return t.id === arr2.id
        ? arr2
        : t;
});
console.log("结果",arr1);

//结果
[{id: 100, name: "小麦", value: "1"},
{id: 101, name: "小明", value: "2"},
{id: 102, name: "小龙虾", value: "100"},
{id: 103, name: "小青", value: "4"},
{id: 104, name: "小龙", value: "5"}]

2、数组替换

var arr1 = [
    { id: 100, name: '小麦', value: "1" },
    { id: 101, name: '小明', value: "2" },
    { id: 102, name: '小白', value: "3" },
    { id: 103, name: '小青', value: "4" },
    { id: 104, name: '小龙', value: "5" },
];
var arr3=[{id:102,name:'小龙虾',value:"100"},{id:104,name:'明道',value:"001"}]; 
this.arr1 = this.arr1.map(item => {
  const data = arr3.find(i => item.id == i.id);
  return {
	...item,
	...data
  };
});

console.log("结果",arr1);

//结果
[{id: 100, name: "小麦", value: "1"},
{id: 101, name: "小明", value: "2"},
{id: 102, name: "小龙虾", value: "100"},
{id: 103, name: "小青", value: "4"},
{id: 104, name: "明道", value: "001"}]
点击阅读全文
上一篇:js监听html页面大小改变+刷新兼容
下一篇:JS如何实现console执行次数