Ajuda em javaSCRIPT

xamonix

Power Member
Olá amigos tenho este código em java que me redirecciona a pagina consoante a linguagem do browser seja ou não portuguesa. O redireccionamento é instantaneo mas eu queria atrasá-lo uns 2 ou 3 segundos. Como faço? Escusado será dizer que sou um ignorante nestas coisa de programção , o código foi sacado doutro site (mas ainda sei fazer copy/paste...lol). Obrigado pela ajuda!

<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
if (navigator.appName == 'Netscape')
var language = navigator.language;
else
var language = navigator.browserLanguage;

/*-------------------------------------------------------------
Netscape instructions:
In Netscape, find the language you want to redirect by going to

Edit Menu --> Preferences...

Then click the '+' box next to 'Navigator' and click 'Languages'
Click 'Add' then find the languages you want and add them below.

---------------------------------------------------------------

Microsoft Internet Explorer instructions:
In MSIE, find the language you want to redirect by going to

Tools Menu --> Internet Options...

Then click the 'Languages' button near the bottom of the page.
Click 'Add' then find the languages you want and add them below.

-------------------------------------------------------------*/
if (language.indexOf('en') > -1) document.location.href = 'english.htm';
else if (language.indexOf('nl') > -1) document.location.href = 'english.htm';
else if (language.indexOf('fr') > -1) document.location.href = 'english.htm';
else if (language.indexOf('de') > -1) document.location.href = 'english.htm';
else if (language.indexOf('ja') > -1) document.location.href = 'english.htm';
else if (language.indexOf('it') > -1) document.location.href = 'english.htm';
else if (language.indexOf('pt') > -1) document.location.href = 'portugues.htm';
else if (language.indexOf('es') > -1) document.location.href = 'english.htm';
else if (language.indexOf('sv') > -1) document.location.href = 'english.htm';
else if (language.indexOf('zh') > -1) document.location.href = 'english.htm';
else if (language.indexOf('ru') > -1) document.location.href = 'english.htm';
else
document.location.href = 'portugues.htm';
// End -->
</script>
 
cria uma funcao q contenha esse codigo tipo

function langdetect()
{

......
}

dp no body com o parametro onload=

poe setTimeout("langdetect()",30000); em e o 1º paramentro e a funcao q vai executar ao fim de 30000 (30 segundos)

Espero ter sido util.
 
Back
Topo