Em đang tạo 1 list danh sách các video từ youtube các link đó em đều lưu trong bảng video( gồm các cột :mavideo;tenvideo;link) trong php admin. Em muốn làm chỉ cần click vào thẻ li là iframe sẽ tự phát video, mà không biết lỗi ở đau click mà không đuọc(như hình)
Đây là đoạn code của em
<body>
<?php
include('ketnoi.php');
include('header.php');
?>
<iframe src="list_bai_viet.php" width="900px" height="500px" id="iframe1" name="iframe" style="float: right;scrolling: none" ></iframe>
<iframe width="350px" height="300" style="float: left;" src="https://www.youtube.com/embed/" class="embed-player" frameborder="0" allowfullscreen></iframe>
<br />
<?php
$query5 = "select * from video order by mavideo desc";
$result5 = mysqli_query($abc,$query5)or die(mysqli_error($abc));
?>
<ul style="width: 300px;">
<?php
while($video=mysqli_fetch_array($result5,MYSQLI_ASSOC)){
$cat = explode('=',$video['link']);
?>
<li class="chay"><a style="cursor: pointer;" title="<?php echo $cat['1'];?>"><i> <?php echo $video['tenvideo'];?></i></a></li>
<?php
}
?>
<script type="text/javascript">
$(document).ready(function(){
$('.chay').click(function(e){
$(this).parent().siblings('.embed-player').attr('src','https://www.youtube.com/embed/'+$(this).children('a').attr('title'))
});
});
</script>
</ul>
</body>