将onclick事件的目标设置为特定的位置。

问题描述 投票:0回答:1

我把我的机身内容分成两部分。左边的有一个地图和按钮。当我点击按钮时,我得到的结果来自于 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 html onclick target
1个回答
0
投票

这和PHP没有太大的关系,你真的应该用HTML+JavaScript来做。

window.href.location总是会把你重定向到另一个路径,永远不会做你想要的事情。

你需要这样的东西。简单地根据窗口宽度从javascript中加载一个HTML页面。

© www.soinside.com 2019 - 2024. All rights reserved.