点击a标签给irfame中传入url不要用JavaScript
如果不使用JavaScript,可以通过在a标签的href属性中传入URL,然后在iframe的src属性中使用该URL来加载内容。
示例代码如下:
<a href="https://www.example.com" target="myframe">点击我加载内容到iframe</a>
<iframe name="myframe" src="" width="500" height="500"></iframe>
在上面的代码中,当点击a标签时,会将"https://www.example.com"作为URL传递给名为"myframe"的iframe的src属性,从而加载该URL的内容到iframe中。
原文地址: http://www.cveoy.top/t/topic/i7sj 著作权归作者所有。请勿转载和采集!