首页 > 解决方案 > 是否可以从我网页上的表格单元格中复制一条数据并将其放在我的另一个网页上?

问题描述

我在网页上有一个 2 x 2 的表格,其中包含不同的价格:

    <table id="table_15" border="1" class="OBJ-1">
    <col style="width:116px;">
    <col style="width:116px;">
    <tr style="height:59px;">
    <td class="TC-1">
    <p class="Normal"><span class="C-3">£40</span></p>
    </td>
    <td class="TC-1">
    <p class="Normal"><span class="C-3">£80</span></p>
    </td>
    </tr>
    <tr style="height:59px;">
    <td class="TC-1">
    <p class="Normal"><span class="C-3">£38</span></p>
    </td>
    <td class="TC-1">
    <p class="Normal"><span class="C-3">£58</span></p>
    </td>
    </tr>
    </table>

在加载第二个网页时,是否可以从第 2 行第 1 列(38 英镑)复制数据并将其放在该页面上?

非常感谢您的帮助,请不要在回复中假设我有任何先验知识。

标签: javascripthtmlhtml-table

解决方案


仅适用于相同的域页面。

localStorage.setItem('price', 'Value of td'); // in the first page
localStorage.getItem('price'); // in the second page

推荐阅读