Javascript 欢迎屏幕,重定向到主页
我想做一个欢迎屏幕,在5秒钟后重定向到主页。我试过了,但没用Javascript 欢迎屏幕,重定向到主页,javascript,html,redirect,Javascript,Html,Redirect,我想做一个欢迎屏幕,在5秒钟后重定向到主页。我试过了,但没用 <script> function myFunc() { setTimeout('Decrement()',5000); } function Decrement() { location="index.html"; } </script> </head> <body onload="myFunc()"> 函数myFunc() { setTimeout('Decrement()
<script>
function myFunc()
{
setTimeout('Decrement()',5000);
}
function Decrement()
{
location="index.html";
}
</script>
</head>
<body onload="myFunc()">
函数myFunc()
{
setTimeout('Decrement()',5000);
}
函数减量()
{
location=“index.html”;
}
这在欢迎页面中。如何使其工作?您在函数声明上有一个输入错误: 将其更改为:
function myFunc()
{
setTimeout('Decrement()',5000);
}
还要验证index.html
是否与html页面位于同一文件夹中
<meta http-equiv="refresh" content="5; url=index.html">
这是一个简单得多的方法
感谢@Syfaro控制台中的一些错误?是否有任何特定的理由使用JavaScript而不仅仅是元刷新?我不知道元刷新,我改变了这一点,但元刷新更简单谢谢@Dor Cohen