Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

435
Visualizações
How to center the pop up window? Image that open a pop up

I'm using the following code:

<center>Supporto Live Chat<br>
  <a onclick="window.open('https://google.com/','Live Chat','scrollbars=yes,width=500,height=715');return false;" href="https://google.com"><img class="wp-image-1182 aligncenter" alt="live-butt" src="https://cdn.pixabay.com/photo/2016/06/06/16/39/phone-1439839_960_720.png" width="142" height="75" /></a>
</center>
<hr>

This can be tested here: https://htmledit.squarefree.com/

But I have the issue that the pop up opened is not centered. Any suggestion on how the code can be edited to have the pop up centered?

Thank you

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Go to this for reference : https://www.geeksforgeeks.org/how-to-center-a-popup-window-on-screen/#:~:text=This%20example%20creates%20the%20pop%20up%20window%20and%20placing%20it%20into%20center

<center>Supporto Live Chat<br>
  <a onclick="window.open('https://google.com/','Live Chat','scrollbars=yes,width=500,height=715');return false;" href="https://google.com"><img class="wp-image-1182 aligncenter" alt="live-butt" src="https://cdn.pixabay.com/photo/2016/06/06/16/39/phone-1439839_960_720.png" width="142" height="75" /></a>
</center>
<hr>
   <script>
    function createPopupWin(pageURL, pageTitle,
                popupWinWidth, popupWinHeight) {
        var left = (screen.width - popupWinWidth) / 2;
        var top = (screen.height - popupWinHeight) / 4;
          
        var myWindow = window.open(pageURL, pageTitle, 
                'resizable=yes, width=' + popupWinWidth
                + ', height=' + popupWinHeight + ', top='
                + top + ', left=' + left);
    }
</script>
  

about 4 years ago · Juan Pablo Isaza Relatório

0

How about a javascript to help you, The javacsript calculates the center of the screen and palces the window there.

       <!DOCTYPE html>
<html>
   <body>
      <script>
         function myPopup(myURL, title, myWidth, myHeight) {
            var left = (screen.width - myWidth) / 2;
            var top = (screen.height - myHeight) / 4;
            var myWindow = window.open(myURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + myWidth + ', height=' + myHeight + ', top=' + top + ', left=' + left);
         }
      </script>
<center>Supporto Live Chat<br>      
        <a onclick=" myPopup ('https://google.com/','Live Chat', 500, 715);"><img 
        class="wp-image-1182 aligncenter" alt="live-butt" 
        src="https://cdn.pixabay.com/photo/2016/06/06/16/39/phone-1439839_960_720.png" 
        width="142" height="75" /></a>
      </center>
   </body>
</html>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda