0
我有以下html和jquery - 我试图用隐藏的span标记替换视频加载的初始视频。 IFrame的src被替换,但视频消失并且不显示任何内容。我相信这可能与托管公司托管和呈现文件的方式有关。我已经尝试过JQuery重载和克隆,但没有喜悦。也许有人已经遇到了类似的问题使用JQuery或Javascript在IFrame中替换另一个视频
<script src="https://code.jquery.com/jquery-1.4.2.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$(".hoveritem").click(function() {
var itemtext = '#' + $(this).attr('rel');
var videolink = itemtext + 'vid';
$("#contentvid").attr('src', $(videolink).html());
//$("#contentvid").replaceWith($("#contentvid")).clone();
});
});
</script>
<style>
.hoveritem{cursor:pointer}
</style>
<div>
<div>
<div id="contenttext">
<div style="float:left;;">
<h3>Hello</h3>
<p>Click the buttom to replace the video</p>
</div>
</div>
<div class="VideoArea" style="border:solid 1px black">
<iframe id="contentvid" width="230" height="120" src="0" frameborder="0" style="overflow:hidden" scrolling="no" allowfullscreen></iframe>
</div>
<div style="clear:both"></div>
</div>
<div> </div>
<div id="GivingGrove" class="hoveritem" rel="givinggrovetext">
<div id="givinggrovetext">
<div >
<div class="TextArea">
<button value="">Change Video</button>
</div>
<span id="givinggrovetextvid" style="display:none">h&w=230</span>
</div>
</div>
</div>
由于博扬 - 我只希望我问这个问题6小时前..把我的头发拉出来 - 所以看起来似乎1.9.1是答案,并将网址放入数据 - 视频属性 - – Paul 2014-10-31 00:03:20