Js method to change the src value of the embed label _ javascript skills

Source: Internet
Author: User
This article mainly introduces how to change the src value of the embed label in js, and involves the javascript operation element attribute technique, which is of great practical value, for more information about how to change the src value of the embed label in js, see the following example. Share it with you for your reference. The specific analysis is as follows:

Today, we have a need for a bunch of videos, links, and links to open related videos on this page.

First, it's easy. Just change the src value to the href value you clicked on.

After trying, I found that this is not the case. How to put the video or how to put it? It will always be the one I just opened.

The second idea is to add a label to the embed, clear the content, and write it into it. This will always work.

I tried it. It is the same as above.

I tried many other similar methods, but I still cannot.

Finally, hide the embed label (display: none) and try again. Finally, you can!

The Code is as follows:

Var tabv = document. getElementById ("f_tabv"); var tabva = tabv. getElementsByTagName ("a"); var tabcv = document. getElementById ("f_tab_cv"); tabcv. innerHTML =''; For (var I = 0; I
 
  
'; Tabcv. getElementsByTagName ("embed") [0]. style. display = "none"; tabcv. innerHTML = ""; tabcv. innerHTML = href2; for (I = 0; I
  
   

I hope this article will help you design javascript programs.

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.