dpbsy60000 2015-04-22 13:07
浏览 23

如何使用Javascript将特定内容从一个表复制到另一个表

I am currently developing a tool to display large amount of data in different tables. Different amount of data from one table has to be assigned into another table more than once. This view takes almost 20 seconds to load and i want to lower the time by manipulating the DOM instead of assigning every match within PHP. I want to place a few identifiers hidden in the first table and on click of one row, show the additional data within the next element.

Here is an example how the Tables look before:

<table>
    <tr>
        <th>Name</th>
    </tr>
    <tr class="iWantToClickThis">
        <td>Bla Bla</td>
        <td style="visibility:hidden;">3,5</td>
    </tr>
</table>

<table style="visibility:hidden">
    <tr>
        <th>Additional Header</th>
    </tr>
    <tr id="1">
        <td>Additional Info 1</td>
    </tr>
    <tr id="2">
        <td>Additional Info 2</td>
    </tr>
    <tr id="3=>
        <td>Additional Info 3</td>
    </tr>
    <tr id="4">
        <td>Additional Info 4</td>
    </tr>
    <tr id="5">
        <td>Additional Info 5</td>
    </tr>
    <tr id="6">
        <td>Additional Info 6</td>
    </tr>
</table>

And after the click:

<table>
    <tr>
        <th>Name</th>
    </tr>
    <tr class="iWantToClickThis">
        <td>Bla Bla</td>
        <td style="visibility:hidden;">3,4,5</td>
    </tr>
    <tr>
        <td colspan="2>
            <table>
                <tr>
                    <th>Additional Header</th>
                </tr>
                <tr id="3">
                    <td>Additional Info 3</td>
                </tr>
                <tr id="5">
                    <td>Additional Info 5</td>
                </tr>
            </table>
        </td>
</table>

I've found out how to achieve this with a single row but how do i do that with different, identitying them by their ids?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥30 python代码,帮调试,帮帮忙吧