0

I have 2 pages

page1.html

<html>
  <head>
     <script src="sorttable.js"></script>
     <script type="text/javascript">     
        function PrintDiv(id) {            
           var divToPrint = document.getElementById(id);
           var popupWin = window.open("page2.html");

           // what here?    
           popupWin.document.getElementById('div2').appendChild(divToPrint);
           popupWin.document.getElementById(id + '_t').style.display = "block";
           popupWin.document.getElementById(id + '_t').setAttribute("class","sortable");

        }
     </script>
   </head>
        <body >
            <div id="divToPrint" >
                <table class = "sortable" id="divToPrint_t" style="display:none;">
                <tr>   
           <th>Edificio</th>
           <th>Tipo</th>
        </tr>
        <tr>
              <td>E1</td>
              <td>T1</td>
        </tr>
        <tr>
              <td>A1</td>
              <td>Q1</td>
        </tr>
        </table>
            </div>
        <div>
            <input type="button" value="print" onclick="PrintDiv('divToPrint');" />
        </div>
        </body> 
</html>

page2.html

<html>
  <head>
    <script src="sorttable.js"> </script>
   </head>
<body>
<div id="div2">
</div>
</body>
</html>

I need that, when I press button, open new tab, with page2.html, and with the table in the DIV div2... with display block, and keeping class sortable for sorting.

How can do it?

1

1 Answer 1

0

I'm pretty sure you have to use Ajax for what you want to do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.