【问题标题】:How can I target video links to one iframe?如何将视频链接定位到一个 iframe?
【发布时间】:2017-10-31 14:33:09
【问题描述】:

我有一个 iframe 和一些链接。 我想如果我点击一个链接它会更新 iframe。

echo"<iframe name='vidframe' width='100%' height='360px' 
    src='http://vidto.me/embed-3t83y76l81ml-640x360.html' frameborder='0' allowfullscreen>
    </iframe>";

echo"<a id='kat' target='vidframe' href='http://vidto.me/embed-32j7qctooybv-640x360.html'>
    load link2</a>";

我使用这种方法,但是当我单击链接时,它会在新选项卡中打开,而不是在 iframe 中。为了打开 iframe 中的链接,我做了哪些更改?

【问题讨论】:

    标签: php html iframe


    【解决方案1】:

    您的代码有些正确,但您的视频网址已损坏。我将 URL 更改为 youtube 视频以测试它是否正常工作:

        <iframe name='vidframe' width='100%' height='360px' 
            src='https://www.youtube.com/embed/x_p0VGctlOk' frameborder='0' allowfullscreen>
            </iframe>";
    
        <a id='kat' target='vidframe' href='https://www.youtube.com/embed/HuQSWt-jj8k'>
            load link2</a>";
    

    【讨论】:

      【解决方案2】:

      如果你想在新页面中加载完整的视频,也许你可以使用这个

         echo"<iframe name='vidframe' width='100%' height='360px' 
              src='http://vidto.me/embed-3t83y76l81ml-640x360.html' frameborder='0' allowfullscreen>
              </iframe>";
          echo"<a id='kat' target='_blank' href='http://vidto.me/embed-32j7qctooybv-640x360.html'>
              load link2</a>";
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-02-15
        • 1970-01-01
        • 2011-06-09
        • 2012-11-17
        • 1970-01-01
        • 2020-04-30
        • 2013-07-22
        相关资源
        最近更新 更多