【发布时间】:2016-03-18 16:24:48
【问题描述】:
我有<iframe src="myYouTubeLink" onload="test">
如何才能将 iFrame src 放入“测试”功能?
function test() {
// obtain the iframe src
var code = false;
if (code)
alert('code: ' + code);
}
<h2>this is the video</h2>
<div style="width:150px">
<div class="video-container">
<iframe id="test456" src="https://www.youtube.com/embed/amDMGIyyrlw" onload="test()">
</iframe>
</div>
</div>
这里是 codepen...
附言。
我需要从测试中获取调用者,然后是 caller.src... 因为我将对多个元素使用相同的函数。
【问题讨论】:
标签: javascript jquery iframe youtube