Condividi:        

Popup centrale

Hai problemi con i file Zip, vuoi formattare l'HD, non sai come funziona FireFox? O magari ti serve proprio quel programmino di cui non ricordi il nome! Ecco il forum dove poter risolvere i tuoi problemi.

Moderatori: Dylan666, hydra, gahan

Popup centrale

Postdi JasonX » 09/01/04 04:58

Ciao sto usando il seguente codice per far aprire cliccando un link una popup con il seguente codice
javascript:openWindow=void(window.open('nomepagina.html','newWin','scrollbars=0, width=350,height=350'))

Il problema è che la popup si apre a casaccio mentre io vorrei che si aprisse con precisione geometrics :lol: al centro. E' fattibile come cosa aggiungendo qualcosa in questo codice???

Mucias Grazias :D
JasonX
Utente Senior
 
Post: 218
Iscritto il: 20/06/03 00:20
Località: Roma

Sponsor
 

Postdi Triumph Of Steel » 09/01/04 08:57

Codice: Seleziona tutto
function PopCenter(theUrl,WinName,width,height,scrollbar) {
// theUrl    = The page
// width   = Width of the window
// height   = Height of the windows
// scroll   = Do You want the Scroll??? ][ Value = yes|no
//
// brought to you by []==ThoR®
//
   var x = screen.availWidth
   var y = screen.availHeight
   var spaceSx = (x - width)/2
   //var spaceUp = 0                              // To Point PopUp top
   var spaceUp = (y - height)/2                     // To point PopUp in the center

   winparams   = ""                              // Start Params for Window
   winparams   = winparams + "scrollbars=" + scrollbar      // Scroll
   winparams    = winparams + ",resizable=no"      // Resizable
   winparams    = winparams + ",left=" + spaceSx         // Space From Left
   winparams    = winparams + ",top=" + spaceUp            // Space From Top
   winparams    = winparams + ",width=" + width            // Windowz Width
   winparams    = winparams + ",height=" + height         // Windowz Height
   winparams    = winparams + ",directory=no"            // The Tool Bars Menu
   winparams    = winparams + ",status=no"               //
   winparams    = winparams + ",location=no"            //
   winparams    = winparams + ",toolbar=no"               // -------------------
   // Open window
   ThoR   = new Object(                         );
   // Active window
   ThoR.focus();
}


per richiamarlo..

Codice: Seleziona tutto
<a href="javascript:PopCenter('page.htm','PopUp','300','250','no');">Click</a>
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00

Postdi Michelangelo » 19/01/04 18:43

Pare non funzionare: quando clicco nella pagina sul link per testare il funzionamento... mi dà quel messaggio del debug...
Michelangelo the party dude
---------------------------------
http://www.tartarugheninja.it il fan site ufficiale italiano delle simpatiche e divertenti Tartarughe Ninja.
Michelangelo
Utente Junior
 
Post: 38
Iscritto il: 25/10/03 14:17
Località: Vignole Borbera (AL)

Postdi Dylan666 » 19/01/04 19:56

Prova così:
Codice: Seleziona tutto
<HEAD>
<SCRIPT LANGUAGE="javascript">
function centra(url, width, height)
   {
   if (document.all)
      {
      var x = window.screenLeft;
      var y = window.screenTop;
      var w = window.document.body.offsetWidth;
      var h = window.document.body.offsetHeight;
      }
  else
   {
   var x = window.screenX;
   var y = window.screenY;
   var w = window.outerWidth;
   var h = window.outerHeight;
   }
  var cntx = x + Math.round((w - width) / 2);
  var cnty = y + Math.round((h - height) / 2);
  window.open (url, null, 'left=' + cntx + ',top=' + cnty + ',width=' +
width + ',height=' + height);
}
</SCRIPT>
<BODY>
<A HREF="javascript:centra('tua.htm',200,200);">apri</A>
</BODY>
Avatar utente
Dylan666
Moderatore
 
Post: 39988
Iscritto il: 18/11/03 16:46

Postdi Triumph Of Steel » 19/01/04 22:45

scusa.. ti ho passato un JS diverso...
quello giusto è:
Codice: Seleziona tutto
function PopCenter(theUrl,WinName,width,height,scrollbar) {
// theUrl    = The page
// width   = Width of the window
// height   = Height of the windows
// scroll   = Do You want the Scroll??? ][ Value = yes|no
//
// brought to you by []==ThoR®
//
   var x = screen.availWidth
   var y = screen.availHeight
   var spaceSx = (x - width)/2
   //var spaceUp = 0                              // To Point PopUp top
   var spaceUp = (y - height)/2                     // To point PopUp in the center

   winparams   = ""                              // Start Params for Window
   winparams   = winparams + "scrollbars=" + scrollbar      // Scroll
   winparams    = winparams + ",resizable=no"      // Resizable
   winparams    = winparams + ",left=" + spaceSx         // Space From Left
   winparams    = winparams + ",top=" + spaceUp            // Space From Top
   winparams    = winparams + ",width=" + width            // Windowz Width
   winparams    = winparams + ",height=" + height         // Windowz Height
   winparams    = winparams + ",directory=no"            // The Tool Bars Menu
   winparams    = winparams + ",status=no"               //
   winparams    = winparams + ",location=no"            //
   winparams    = winparams + ",toolbar=no"               // -------------------
   // Open window
   ThoR   = window.open(theUrl,WinName,winparams);
   // Active window
   //ThoR.focus();
}
Avatar utente
Triumph Of Steel
Moderatore
 
Post: 7852
Iscritto il: 22/08/01 01:00


Torna a Software Windows


Topic correlati a "Popup centrale":


Chi c’è in linea

Visitano il forum: Nessuno e 109 ospiti