如何通过链接在iframe中打开特定文件


  例如;
  http://ccgi.vaegar.force9.co.uk/examples/SwingSet2_demo/index.html


我想导航到ButtonDemo,打开链接时,如何

我尝试了以下方法,但是没有用

<a href="http://ccgi.vaegar.force9.co.uk/examples/SwingSet2_demo/index.html?target=ButtonDemo.java.html">ButtonDemo</a>

<a href="http://ccgi.vaegar.force9.co.uk/examples/SwingSet2_demo/index.html?ButtonDemo.java.html">ButtonDemo</a>


提前致谢

最佳答案

如果您的iframe拥有name属性,例如name="myFrame",则可以在锚点标签target="myFrame"上使用target属性

<a target="myFrame" href="http://ccgi.vaegar.force9.co.uk/examples/SwingSet2_demo/index.html">ButtonDemo</a>

<a target="myFrame" href="http://ccgi.vaegar.force9.co.uk/examples/SwingSet2_demo/index.html">ButtonDemo</a>


还有你的iframe

<iframe name="myFrame" ></iframe>


Here's一个关于punker的工作示例

09-20 18:29