2017-05-04 87 views
0

我在页面上有两个按钮和两个不同的框架。当点击按钮1时,我希望它在框架a上显示,当点击按钮2时,我希望它显示在框架b上。出于某种原因,我无法让按钮显示在不同的框架上。只有一个框架。HTML按钮定位

做了一些测试,它似乎是唯一的目标事项是在第一个表单动作标签。按钮标签中的目标是无用的。

请帮忙!

<body> 
<center> 
<form action="test.php" method="post" target="frame_a"> 
<button type="submit" name="action" value="Active" 
target="frame_a">Active</button> 
<button type="submit" name="action1" value="Completed" 
formaction="test2.php" target="frame_b">Completed</button> 
</td> 
</form> 

<iframe width="900" height="1000" src="" name="frame_a" width="100%" 
height="100%"></iframe> 

<iframe width="900" height="1000" src="" name="frame_b" width="100%" 
height="100%"></iframe> 

</body> 
+1

http://stackoverflow.com/a/26253115/4229270 – Sinto

回答

0

尝试把按钮在一个单独的形式

<form action="test.php" method="post" target="frame_a"> 
    <button type="submit" name="action" value="Active" 
target="frame_a">Active</button> 
</form> 

<form action="test.php" method="post" target="frame_b"> 
    <button type="submit" name="action1" value="Completed" formaction="test2.php" target="frame_b">Completed</button> 
</form>