Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

henderson

Redirecionamento

Recommended Posts

Gostaria de saber como redirecionar de uma pagina para outra utilizando javascript ,sem abrir uma nova janela do navegador, ou seja , quero que abra utilizando a mesma janela que a chamou...

Compartilhar este post


Link para o post
Compartilhar em outros sites

Olá,

Seguinte, experimente este, ele dá tempo p/ o cara se preparar p/ ver o que irá aparecer:

<div id="splashcontainer" width="200"></div>

<layer id="splashcontainerns" width="200"></layer>

<script language="JavaScript">

var intervals=4000

var targetdestination="menu.html"

var splashmessage=new Array()

var openingtags='<font face="Arial Black" size="3" color="red"><i>'

splashmessage[0]="Aguarde..."

splashmessage[6]="Você está sendo redirecionado..."

var closingtags='</font>'

var i=0

function displaysplash_ie(){

if (i<splashmessage.length){

sc_ie.style.visibility="hidden"

sc_ie.innerHTML='<b><center>'+openingtags+splashmessage+closingtags+'</center></b>'

sc_ie.style.top=document.body.scrollTop+document.body.clientHeight/2-sc_ie.offsetHeight/2

sc_ie.style.visibility="visible"

i++

}

else{

window.location=targetdestination

return

}

setTimeout("displaysplash_ie()",intervals)

}

function displaysplash_ns(){

if (i<splashmessage.length){

sc_ns.visibility="hide"

sc_ns.document.write('<b>'+openingtags+splashmessage+closingtags+'</b>')

sc_ns.document.close()

sc_ns.left=pageXOffset+window.innerWidth/2-sc_ns.document.width/2

sc_ns.top=pageYOffset+window.innerHeight/2-sc_ns.document.height/2

sc_ns.visibility="show"

i++

}

else{

window.location=targetdestination

return

}

setTimeout("displaysplash_ns()",intervals)

}

function positionsplashcontainer(){

if (document.all){

sc_ie=document.all.splashcontainer

sc_ie.style.left=document.body.scrollLeft+document.body.clientWidth/2-sc_ie.

offsetWidth/2

sc_ie.style.top=document.body.scrollTop+document.body.clientHeight/2-sc_ie.offsetHeight/2

displaysplash_ie()

}

else if (document.layers){

sc_ns=document.splashcontainerns

sc_ns.left=pageXOffset+window.innerWidth/2-sc_ns.document.width/2

sc_ns.top=pageYOffset+window.innerHeight/2-sc_ns.document.height/2

sc_ns.visibility="show"

displaysplash_ns()

}

else

window.location=targetdestination

}

window.onload=positionsplashcontainer

</script>

 

 

Não esqueça de fazer as mudanças necessarias, ok?

 

[]s

Rodney

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.