Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
closing the pop up window after clicking on cancel

I am printing on the click of the button using javascript. when I click on the button, two windows open, one is the actual print window and another one os the pop that shows the content that needs to be printed. when I click on the cancel or print button, I want the pop to be closed. How can I achieve that. Below is the code:

<script>
        function printDiv() {
            var divContents = document.getElementById("GFG").innerHTML;
            var a = window.open('', '', 'height=500, width=500');
            a.document.write('<html>');
            a.document.write('<body > <h1>Div contents are <br>');
            a.document.write(divContents);
            a.document.write('</body></html>');
            a.document.close();
            a.print();
        }
    </script>

<body style="text-align:center;">
        <div class="container" id="GFG">
        <div class="row justify-content-center">
            <div class="col-sm-4">
                <asp:GridView ID="grdCalculate" runat="server" GridLines="Horizontal" Width="100%"
                    CssClass="table table-responsive table-hover table-striped table-bordered table-condensed">
                </asp:GridView>
            </div>
        </div>
    </div>

    <input type="button" value="click" onclick="printDiv()"> 
</body>

I want to get rid of the pop-up when the print or cancel button is clicked.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda