function settime()
{
var myyear,mymonth ,myweek,myday,mytime,mymin,myhour,mysec;
var mydate=new Date();
myyear=mydate.getFullYear();
mymonth=mydate.getMonth();
myday =mydate.getDate();
myhour=mydate.getHours();
mymin=mydate.getMinutes();
mysec=mydate.getSeconds();
mytime="Today is:" myyear "year" mymonth "month" myday "day" myhour ":" mymin ":" mysec;
document.getElementById('xwgtime').innerHTML=mytime;
setTimeout('settime()',1000 );
}
This will show the time! The script is really powerful. . . ! This method can also be used to make the website switch to another page after a certain amount of time!
For example:
function SetTime(NomeTime)
{
document.getElementById("TimeValue").innerHTML=NomeTime "Automatically log in after seconds";
NomeTime--;
if(NomeTime==-1)
{
document .getElementById("TimeValue").style.display="none";
return;
}
window.setTimeout("javascript:SetTime(" NomeTime ")",1000);
}
Where NomeTime is the initial time size, such as 10 seconds!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn