javascript - 是否可以从我网页上的表格单元格中复制一条数据并将其放在我的另一个网页上?
问题描述
我在网页上有一个 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 英镑)复制数据并将其放在该页面上?
非常感谢您的帮助,请不要在回复中假设我有任何先验知识。
解决方案
仅适用于相同的域页面。
localStorage.setItem('price', 'Value of td'); // in the first page
localStorage.getItem('price'); // in the second page
推荐阅读
- c# - 使用 EF Core FromSql() 在 DbSet 上进行全文索引搜索
同一张表上的 ValueObject 应该没有 LEFT JOIN - android - 将csv文件导入SQLite并访问Android Studio
- c# - NServiceBus 序列化问题
- wordpress - 多个 Rest API 条目出现但帖子已被删除
- c++ - 如何使用二维数组构建如下坐标系?C++
- python - 是否可以重新训练谷歌的通用句子编码器,以便在编码句子时考虑关键字?
- reactjs - 如何使用 React 创建确认对话框组件
- mysql - 带有来自 Docker Hub 的自定义图像的多容器应用程序
- notifications - 来自 Azure DevOps 的实时通知
- logging - 使用 Logstash 解析 Kubernetes syslog 日志