点击弹窗提示,3秒后关闭窗口并跳转新的页面

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Document</title> <script type="text/javascript" src="jquery-1.8.3.min.js"></script> <style type="text/css" > /*灰色遮罩层*/ .fade{ width:100%; height:100%; background:rgba(0, 0, 0, 0.5); position: fixed; left: 0; top: 0; z-index: 99; } /*弹出层*/ .succ-pop{ width: 400px; height: 300px; background: #fff; position: fixed; left: 50%; top: 50%; margin-left: -200px; margin-top: -150px; z-index: 999; border-radius: 5px; } .succ-pop h3.title{ text-align: center; font-size: 22px; color: #ce002c; } </style> <script> function showDiv(){ $("#fade").show(); $("#pop").show(); setTimeout(function(){ //var windowOpen = window.open("http://www.baidu.com"); //if (windowOpen == null || typeof(windowOpen)=='undefined'){ //$('#feedback').html('新窗口无法打开,请检查你的浏览器设置。') window.location.href="http://www.baidu.com"; } hideDiv(); }, 3000); } function hideDiv(){ $("#fade").hide(); $("#pop").hide(); } </script> </head> <body> <div class="fade" id="fade" style="display:none"></div> <div class="succ-pop" id="pop" style="display:none"> <h3 class="title"> 提示文字 </h3> </div> <input id="show" type="button" readonly="readonly" value="点击显示" onclick="showDiv()"/> </body> </html>
分类:
HTML5
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
2016-11-13 Linux服务器上安装MySql数据库(默认安装,密码为空),首次使用需要修改密码