• js 切换embed的src值


    <div id="mod_player" class="mod_player"><embed id="evideo" src="http://static.video.qq.com/TPout.swf?vid=d0110upcugq&auto=1" allowfullscreen="true" quality="high" width="650" height="472" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash"></div>
    点击右边列表,左边刷新播放,开始的代码:
    
         $(document).ready(function(){
         //点击右边列表的某个链接,视频播放切换
            $('#mod_videolist li').find('a').each(function(i, elem){
               $(this).click(function(){
                  $('#mod_player > embed').attr('src', $(this).attr('href'));
                   return false;
                });
                //document.getElementById('evideo').play();
           });
         });
     
    
    这样只能切换embed的src值,但并不会切换播放(奇怪firefox能够切换播放,其它浏览器只能改变了src),就是没有触发视频的play动作,但因为不是html5的<video>标签,embed标签无法用js传入play()方法,所以只能想别的方法来曲线救国,如下:
    
          $(document).ready(function(){
           //点击右边列表的某个链接,视频播放切换
           $('#mod_videolist li').find('a').each(function(i, elem){
              $(this).click(function(){
                 $('#mod_player > embed').remove();
                   var str = '<embed id="evideo" src="'+ $(this).attr('href') +'" allowfullscreen="true" quality="high" width="650" height="472" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash">';
                  $('#mod_player').html(str);
                   return false;
                });
          });
        });
    

      

  • 相关阅读:
    Linux cron
    web报表工具FineReport常用函数的用法总结(文本函数)
    web报表工具FineReport常用函数的用法总结(文本函数)
    oracle instr函数
    死锁的例子和 synchronized 嵌套使用
    死锁的例子和 synchronized 嵌套使用
    Perl 监控批量错误
    Linux以百万兆字节显示内存大小
    Linux以GB显示内存大小
    Linux以KB显示内存大小
  • 原文地址:https://www.cnblogs.com/lccnblog/p/3772233.html
Copyright © 2020-2023  润新知