求一個JS代碼 中間彈出一個視窗
網站改版了 想讓老的網站的用戶跳轉到新網站。。
做一個提示窗 進了老網站 后 頁面會提示一個很大的視窗 點擊進入新網站。。
怎么實作? 百度搜了一些 找不到合適的
uj5u.com熱心網友回復:
不知道具體需求 你看一下<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
#a{
width: 300px;
height: 200px;
border: 1px solid black;
margin: 200px auto;
text-align: center;
line-height: 200px;
}
button{
width: 50px;
height: 30px;
}
</style>
</head>
<body>
<div id="a">
<button id="btn">
跳轉
</button>
</div>
</body>
<script>
var btn = document.getElementById('btn');
console.log( btn );
btn.onclick = function (){
window.open("http://www.baidu.com");
}
</script>
</html>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/108258.html
標籤:JavaScript
上一篇:逆天的匹配演算法
下一篇:子組件在父組件里遍歷,并通過props接收父組件遍歷的item。但是子組件使用呼叫方法將item作為實參,報錯undefined
