【问题标题】:Setting the target of an onclick event to a specific location将 onclick 事件的目标设置为特定位置
【发布时间】:2020-05-03 10:21:54
【问题描述】:

我将正文内容分成两部分。左边有一张地图和按钮。当我点击按钮时,我会在另一个窗口中从Arad.php 获得结果。

如何将目标设置在我身体的后半部分(右分)?

<body> 
    <div class="split left">
        <div class="centered">    
            <h2>Button on Image</h2>
            <p>Add a button to an image:</p>
            <div class="container">
                <img src="Harta_Romaniei.jpg" alt="Harta_Romaniei" style="width:100%">
                <button class="btnarad"; onclick= "window.location.href='Arad.php'"; Target="split right">Arad</button>
                <button class="btntimisoara">Timisoara</button>
            </div>        
        </div>
    </div>
    <div class="split right">
      <div class="centered">
        <h2>Information</h2>

        // I want the information here!

        </div>
    </div>
</body>

【问题讨论】:

  • PHP 标记在这里做什么?
  • 你想达到什么目的?

标签: php html onclick target


【解决方案1】:

和 PHP 关系不大,你真的应该用 HTML + JavaScript 来做。

window.href.location 将始终将您重定向到另一条路线,并且永远不会做您想做的事情。

你需要这样的东西:Simple Load an HTML page from javascript based on window width

【讨论】:

    猜你喜欢
    • 2013-05-12
    • 1970-01-01
    • 2013-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多