我想使用reg exp替換自動播放= 1的iframe url到autoplay = 0。使用正則表達式替換網址
jQuery(document).ready(function($){
$('.playButton').click(function(){
$('.flex-active-slide iframe').contents().find("iframe")[0].src=src.replace(/\&autoplay\=\d/,"&autoplay="+1);
});
$(".close_icon").click(function(){
$('.flex-active-slide iframe').contents().find("iframe")[0].src=src.replace(/\&autoplay\=\d/,"&autoplay="+0);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="playButton">Play</div><div class="close_icon">Close</div>
<div class="flex-active-slide">
<iframe src="">
#document
<html>
<body>
<iframe src="https://www.youtube.com/embed/C0DPdy98e4c?width=640&autoplay=1">
#document
<html>
<body>
</body>
</html>
</iframe>
</body>
</html>
<iframe>
</div>
我要重播src.but它不工作
昨天你問如何訪問內第一幀並忽略了答案http://stackoverflow.com/a/41356414/1175966。現在你基本上都回到同一個地方詢問幾乎相同的問題 – charlietfl