Retourne automatiquement après 1,3 seconde
La copie de code est la suivante:
<span id = "totalsecond"> 3 </span> revenez automatiquement après 3 secondes
<script lingots = "javascript" type = "text / javascript">
<! -
var second = document.getElementById ('totalSecond'). TextContent;
if (navigator.appname.indexof ("explorateur")> -1) // juger s'il s'agit d'un navigateur IE ou d'un navigateur Firefox, et utilisez les mesures correspondantes pour obtenir le nombre de secondes
{
second = document.getElementById ('totalSecond'). InnerText;
} autre
{
second = document.getElementById ('totalSecond'). TextContent;
}
setInterval ("redirect ()", 1000);
Fonction Redirect ()
{
if (deuxième <0)
{
location.href = 'http://www.baidu.com';
} autre
{
if (navigator.appname.indexof ("explorateur")> -1)
{
document.getElementById ('totalSecond'). InnerText = second--;
} autre
{
document.getElementById ('totalSecond'). TextContent = second--;
}
}
}
->
</cript>