Js dynamic switching video

Source: Internet
Author: User
Some code is pasted here for your reference. & Lt; spanstyle & quot; font-size: 18px; & quot; & gt; & lt; liid & quot; about_li6 & quot; & gt; & lt; h2id & quot; about_img6 & quot; & gt; & lt; span & gt; Media Center & lt;/span & gt; & lt; im some code is attached here for your reference.
  
  • MEDIA Center back to MEDIA center MEDIA '> <% # Display. Tool_CutString (Eval ("Title"), 25) %>
  •  

    The above code is the style code, and the above is the video display area. The following video Title List is read through repeater. I bind the read video address to the class attribute of tag, to obtain the value when you click.
    Function about_img6 () {$ ("# about_ul li" ).css ("width", "146px"); $ ("# media_list_content ul li" ).css ("width ", "125px"); $ ("# about_ul li h2 "). fadeIn (500); $ ("# about_ul li h2 span, # about_ul li h2 img "). hide (); $ ("# about_ul li. about_sub "). hide (); $ ("# about_ul "). animate ({"width": "1045px"}); $ ("# about_li1, # about_li2, # about_li3, # about_li4, # about_li5, # about_li7 "). animate ({"width": "90px"}); $ ("# about_li6 "). animate ({"width": "505px"}); $ ("# about_content6 "). show (); $ ("# about_img6 "). hide (); var srclist = document. getElementById ("media_list_content"); var firsrc = srclist. getElementsByTagName ("a") [0]. className; // The setvideo (firsrc) of the first video is loaded by default; };$ ("# media_list_content "). click (function () {setvideo ($ (this ). attr ("class") ;}); // function setvideo (url) {var youku = document. getElementById ("flv1"); var htmlstr =""; Htmlstr + =""; Htmlstr + =""; Htmlstr + =""; Htmlstr + =""; Htmlstr + =""; Htmlstr + =""; Youku. innerHTML =" "; youku. innerHTML = htmlstr ;};

     

    This code is a js Code. When you click to expand the media center, first obtain the video address in the class attribute of the first a tag in the video title list below, then call the video display method setvideo (url) to pass the obtained address to the page and print the object and embed tags on the page. The two tags are used together to ensure compatibility with various browsers. When the video title is clicked, use attr to obtain the class value of the currently clicked a tag, and then call the setvideo (url) method to display the corresponding video on the page.
    Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.