如何在表中放置此脚本?

时间:2019-07-15 15:16:55

标签: javascript php

我正在从具有定价的Google工作表中提取数据。我的目标是将它放在div中,并最终在图像上显示它。我现在遇到的问题是,它一直放在页面的左上方。我该如何定位,我也觉得这不是正确的方法。也许有人有解决方案或将我指向正确的方向?

<html>
<body>
  <pre id='data'></pre>
  <pre id='data1'></pre>
</body>
<script>
  const onDataLoaded = (data) => {
    const e20Content = data.feed.entry.find((entry) => entry.title.$t == 'A2').content.$t
    document.getElementById('data').innerHTML = e20Content
  }
</script>

<script>
  const onDataLoaded1 = (data1) => {
    const e20Content = data1.feed.entry.find((entry) => entry.title.$t == 'B2').content.$t
    document.getElementById('data1').innerHTML = e20Content1
  }
</script>




<table>
<tr>
    <td>Price</td>
    <td>Model</td>

</tr>
<tr>
    <td><script src="https://spreadsheets.google.com/feeds/cells/1UXGv7fA_B5GI2iyWrbBuXOaSqjIW2YHJLYnxq7dcbFc/1/public/basic?alt=json-in-script&callback=onDataLoaded1"></script><pre id='data'></pre></td>
    <td><script src="https://spreadsheets.google.com/feeds/cells/1UXGv7fA_B5GI2iyWrbBuXOaSqjIW2YHJLYnxq7dcbFc/1/public/basic?alt=json-in-script&callback=onDataLoaded"></script><pre id='data1'></pre></td>
</tr>
</table>

</html> 

0 个答案:

没有答案