首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将DIV内容替换为其他页面中的其他DIV

将DIV内容替换为其他页面中的其他DIV
EN

Stack Overflow用户
提问于 2014-02-16 04:39:56
回答 1查看 137关注 0票数 0

我有两页

page1.html

代码语言:javascript
复制
<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

代码语言:javascript
复制
<html>
  <head>
    <script src="sorttable.js"> </script>
   </head>
<body>
<div id="div2">
</div>
</body>
</html>

我需要它,当我按下按钮,打开新的标签,用page2.html,和DIV div2中的表格……具有显示块,并保持类的可排序以进行排序。

怎么才能做到呢?

EN

回答 1

Stack Overflow用户

发布于 2014-02-16 04:42:49

我非常确定您必须使用Ajax来完成您想要做的事情

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21803350

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档