Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/10/2010, 03:37
fernan2010
 
Fecha de Ingreso: febrero-2010
Mensajes: 105
Antigüedad: 14 años, 2 meses
Puntos: 1
Simular salvapantallas, NO TERMINA DE FUNCIONAR


Hola,

tengo este codigo en una pagina ASPX, para simular un salvapantallas.
En la pagina donde salta el salvapantallas tengo este código.
Código Javascript:
Ver original
  1. Timeout=5000 // delay for effect
  2. Timer=""
  3. var blurred;
  4. function oStatic() {
  5. clearTimeout(Timer)
  6. if(timerRunning == true||blurred==1){ // if win1 opened or opener is blurred, return
  7. return
  8. }
  9. timerRunning = true
  10. win1=window.open("Salvapantallas.aspx",'','fullscreen') // if win1 not opened, open win1
  11. Timer=setTimeout("oStatic()",Timeout) // run function oStatic after delay
  12. }
  13.  
  14. opened=0 // win1 not opened
  15.  
  16. function oActive(){
  17. clearTimeout(Timer)
  18. if(opened==1){return} // if win1 opened, return
  19. timerRunning = false
  20. Timer=setTimeout("oStatic()",Timeout) // if win1 not opened run function oStatic after delay
  21. }
  22.  
  23. document.onmousemove=oActive // detect mouse movement
  24. document.onmousedown=oActive // detect if button pressed
  25. document.onkeypress=oActive // detect if key press
  26.  
  27. setTimeout("oActive()",1000) // start
  28. //-->
  29.  
  30. </script>
  31. <BODY onblur="blurred='1'" onfocus="blurred='0';oActive()">

y la pagina que hace de Salvapantallas este otro:

Código Javascript:
Ver original
  1. <script language="JavaScript">
  2. <!--
  3. // ********** Screensaver Part 2 **********
  4.  
  5. var ignore;
  6. function init()
  7. {
  8.  
  9. opener.opened=1
  10. ignore=0 // ignore busy cursor when page loads
  11. document.onmousemove=gone // detect mouse movement document.onmousedown=gone // detect if button pressed
  12. document.onkeypress=gone // detect if key press
  13. }
  14.  
  15. function gone(){
  16. if(ignore==0){
  17. ignore=1
  18. return}
  19. history.back()
  20. self.close()
  21. }
  22. document.onmousemove=gone // detect mouse movement
  23. document.onmousedown=gone // detect if button pressed
  24. document.onkeypress=gone // detect if key press
  25.  
  26. setTimeout("init()",10000)
  27. //-->
  28. </script>

Os cuento lo que me hace, la primero parte funcina bien porque el salvapantallas salta perfectamente, pero cuando aparece la pagina de salvapantallas inmediatamente vuelve a la pagina anterior, es como si esta funcion : setTimeout("init()",10000), no funcionara correctamente.