html网页自动跳转代码是什么

html网页自动跳转代码:1、“<meta http-equiv="refresh" content="时间;url=页面地址">”;2、使用“window.location.href='页面地址';”。

本教程操作环境:windows7系统、HTML5&&javascript1.8.5版、Dell G3电脑。

1、html中使用meta中跳转,通过meta可以设置跳转时间和页面

<head>
<!--只是刷新不跳转到其他页面 -->
<meta http-equiv="refresh" content="5">
<!--定时转到其他页面 -->
<meta http-equiv="refresh" content="5;url=index.html"> 
</head>

2、通过javascript中实现跳转

// 直接跳转
window.location.href='index.html';
// 定时跳转
setTimeout("javascript:location.href='index.html'", 5000);

以上就是html网页自动跳转代码是什么的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » HTML5 答疑