【问题标题】:How to access input coordinates using JavaScript [duplicate]如何使用 JavaScript 访问输入坐标 [重复]
【发布时间】:2021-07-12 19:29:33
【问题描述】:
<body>
    <?php
        echo "<input type='text' id='jak'  value='1' style='position:absolute ; top:400px; '/>";
        
    ?>
    <input type="IMAGE" name="Baadee" id="Baadee" src="Baadee.png" style="position: absolute ; left: 795px ; top:50px ;">

    <script>
      if (document.getElementById("jak").value == 1) {

        document.getElementById("Baadee").style.top = 650;
      }
    </script>

您好,我正在运行此代码,但它没有转到 650 坐标。

【问题讨论】:

  • 单位怎么样??

标签: javascript php image input coordinates


【解决方案1】:

当你设置一个样式的顶部值时,它应该是一个以“px”结尾的字符串。我会更新你的代码:document.getElementById("Baadee").style.top = "650px"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-16
    • 2012-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多