0

https://dl.dropboxusercontent.com/u/99737964/video%20online/sermonvideos.html

我是 jquery、javascript 和一般编码的新手。我制作了一个媒体播放器,我可以点击它并在一个框中显示不同的视频,但现在我想知道如何让文本出现在视频框的右侧,以显示视频标题和信息。我现在有文字出现,但我不明白如何在点击新视频后让以前的文字消失。检查网址以查看。感谢帮助!

从网站获取源代码。

4

1 回答 1

0

使用jquery的.html()or函数,给一个包含被点击视频的标题和信息的元素,例如:.text()idclass

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
   $(document).ready(function() { 
       $('.videos').click(function() { 
           var value = $(this).attr('title');
           $('#myInfo').html(value); //this should do the trick or 


           $('#myInfo').text(value); //this should do the trick
       })
   });
</script>

和html

<div class = "videos" title = "this is an information">video 1</div>
<div class = "videos" title = "this is an information">video 2</div>
<div class = "videos" title = "this is an information">video 3</div>
<div class = "videos" title = "this is an information">video 4</div>
<div class = "videos" title = "this is an information">video 5</div>

<div id = "myInfo"></div>
于 2013-07-22T01:10:08.510 回答