!DOCTYPE html html lang=en head meta charset=UTF-8 meta name=viewport content=width=device-width, initial-scale=1.0 titleYour Page Titletitle style , after, before { -webkit-box-sizing border-box; box-sizing border-box; } html { background #000; font-family Arial, Helvetica Neue, Helvetica, sans-serif; } head { display block; position relative; width 200px; margin 10% auto 0; -webkit-animation shvr .2s infinite; animation shvr .2s infinite; } headafter { content ''; width 20px; height 20px; background #000; position absolute; top 30px; left 25px; -webkit-border-radius 50%; border-radius 50%; -webkit-box-shadow 125px 0 0 #000; box-shadow 125px 0 0 #000; -webkit-animation eye 2.5s infinite; animation eye 2.5s infinite; } meta { position relative; display inline-block; background #fff; width 75px; height 80px; -webkit-border-radius 50% 50% 50% 50% 45px 45px 45% 45%; border-radius 50% 50% 50% 50% 45px 45px 45% 45%; -webkit-transform rotate(45deg); transform rotate(45deg); } metaafter { content ''; position absolute; border-bottom 2px solid #fff; width 70px; height 50px; left 0px; bottom -10px; -webkit-border-radius 50%; border-radius 50%; } metabefore { bottom auto; top -100px; -webkit-transform rotate(45deg); transform rotate(45deg); left 0; } metanth-of-type(2) { float right; -webkit-transform rotate(-45deg); transform rotate(-45deg); } metanth-of-type(2)after { left 5px; } metanth-of-type(3) { display none; } body { margin-top 100px; text-align center; color #fff; } bodybefore { content '404'; font-size 80px; font-weight 800; display block; margin-bottom 10px; } bodyafter { content 'Got lost How..... why..... Ahhhh....'; color #1EA7AB; width 120px; font-size 30px; overflow hidden; display inline-block; white-space nowrap; -webkit-animation text-show 2s infinite steps(3); animation text-show 2s infinite steps(3); } @-webkit-keyframes eye { 0%, 30%, 55%, 90%, 100% { -webkit-transform translate(0, 0); transform translate(0, 0); } 10%, 25% { -webkit-transform translate(0, 20px); transform translate(0, 20px); } 65% { -webkit-transform translate(-20px, 0); transform translate(-20px, 0); } 80% { -webkit-transform translate(20px, 0); transform translate(20px, 0); } } @keyframes eye { 0%, 30%, 55%, 90%, 100% { -webkit-transform translate(0, 0); transform translate(0, 0); } 10%, 25% { -webkit-transform translate(0, 20px); transform translate(0, 20px); } 65% { -webkit-transform translate(-20px, 0); transform translate(-20px, 0); } 80% { -webkit-transform translate(20px, 0); transform translate(20px, 0); } } @-webkit-keyframes shvr { 0% { -webkit-transform translate(1px); transform translate(1px); } 50% { -webkit-transform translate(0); transform translate(0); } 100% { -webkit-transform translate(-1px); transform translate(-1px); } } @keyframes shvr { 0% { -webkit-transform translate(1px); transform translate(1px); } 50% { -webkit-transform translate(0); transform translate(0); } 100% { -webkit-transform translate(-1px); transform translate(-1px); } } @-webkit-keyframes text-show { to { text-indent -373px; } } @keyframes text-show { to { text-indent -373px; } } style head body !-- 在这里可以添加页面内容 -- script 创建一个覆盖层 var overlay = document.createElement('div'); overlay.style.position = 'fixed'; overlay.style.top = '0'; overlay.style.left = '0'; overlay.style.width = '100%'; overlay.style.height = '100%'; overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)'; overlay.style.display = 'flex'; overlay.style.justifyContent = 'center'; overlay.style.alignItems = 'center'; overlay.style.zIndex = '1000'; overlay.style.visibility = 'hidden'; 初始隐藏 document.body.appendChild(overlay); 创建确认框 var dialogBox = document.createElement('div'); dialogBox.style.backgroundColor = 'white'; dialogBox.style.padding = '20px'; dialogBox.style.borderRadius = '5px'; dialogBox.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.3)'; dialogBox.style.textAlign = 'center'; dialogBox.style.maxWidth = '80%'; overlay.appendChild(dialogBox); 创建提示文本 var message = document.createElement('p'); message.textContent = '正在返回首页,点击确定继续。'; message.style.color = 'blue'; 设置文本颜色为黄色 dialogBox.appendChild(message); 创建确定按钮 var confirmBtn = document.createElement('button'); confirmBtn.textContent = '确定'; confirmBtn.style.padding = '10px 20px'; confirmBtn.style.margin = '10px'; confirmBtn.style.cursor = 'pointer'; confirmBtn.style.backgroundColor = '#007bff'; confirmBtn.style.color = 'white'; confirmBtn.style.border = 'none'; confirmBtn.style.borderRadius = '3px'; confirmBtn.style.fontSize = '16px'; dialogBox.appendChild(confirmBtn); 设置定时器,在10秒后显示确认框 setTimeout(function() { overlay.style.visibility = 'visible'; 显示覆盖层 }, 10000); 点击确定按钮后的操作 confirmBtn.addEventListener('click', function() { var targetUrl = httpsexample.com; 替换为您要跳转的链接 window.location.href = targetUrl; }); script body html