HighDots Forums  

Si puo' sapere se una finestra e' aperta?

Javascript (Italian) Il linguaggio JavaScript (it.comp.lang.javascript)


Discuss Si puo' sapere se una finestra e' aperta? in the Javascript (Italian) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alun
 
Posts: n/a

Default Si puo' sapere se una finestra e' aperta? - 12-12-2003 , 05:06 AM






Ecco la situazione:
Ho una pagina (madre.html) che chiama una funzione Javascript nella quale
viene aperto un pagina (figlia.html) con un normale
window.open("figlia.html","prova", ...);

Ecco il problema:
Supponiamo che la pagina filglia.html sia aperta e supponiamo che la
funzione Javascript della pagina madre.html venga eseguita di nuovo,
è possibile, in questa funzione, testare che esiste una finestra aperta di
nome figlia.html (oppure utilizzando il keyword "prova" ??) e, se il
risultato del test è positivo, farsi che questa finestra venga messa in
primo piano.
Mille grazie in anticipo per l'aiuto.
Alun



Reply With Quote
  #2  
Old   
ZER0
 
Posts: n/a

Default Re: Si puo' sapere se una finestra e' aperta? - 12-12-2003 , 05:38 AM






On Fri, 12 Dec 2003 11:06:17 +0100, Alun wrote:

Quote:
Ecco il problema:
Supponiamo che la pagina filglia.html sia aperta e supponiamo che la
funzione Javascript della pagina madre.html venga eseguita di nuovo,
è possibile, in questa funzione, testare che esiste una finestra aperta di
nome figlia.html (oppure utilizzando il keyword "prova" ??) e, se il
risultato del test è positivo, farsi che questa finestra venga messa in
primo piano.
Basta che ti salvi un riferimento alla finestra aperta:

var wm=null;

function goofy(){
if (wm && !wm.closed)
wm.focus();
else
wm=window.open("figlia.html","prova", "width=320,height=200");
}

<a href="#" onclick="goofy();return false">click me</a>


--
C'ya,
ZER0 :: coder.gfxer.webDesigner();

"When you have eliminated the impossible, whatever remains,
however improbable, must be the truth." (S.H.)


Reply With Quote
  #3  
Old   
Alun
 
Posts: n/a

Default Re: Si puo' sapere se una finestra e' aperta? - 12-14-2003 , 06:16 PM




"ZER0" <zer0.shock (AT) libero (DOT) it> wrote

Quote:
On Fri, 12 Dec 2003 11:06:17 +0100, Alun wrote:

Ecco il problema:
Supponiamo che la pagina filglia.html sia aperta e supponiamo che la
funzione Javascript della pagina madre.html venga eseguita di nuovo,
è possibile, in questa funzione, testare che esiste una finestra aperta
di
nome figlia.html (oppure utilizzando il keyword "prova" ??) e, se il
risultato del test è positivo, farsi che questa finestra venga messa in
primo piano.

Basta che ti salvi un riferimento alla finestra aperta:

var wm=null;

function goofy(){
if (wm && !wm.closed)
wm.focus();
else
wm=window.open("figlia.html","prova", "width=320,height=200");
}

a href="#" onclick="goofy();return false">click me</a
--
C'ya,
ZER0 :: coder.gfxer.webDesigner();

"When you have eliminated the impossible, whatever remains,
however improbable, must be the truth." (S.H.)
Mille grazie. Funziona perfettamente.
Ciao,
Alun




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.