0

I want to have an embedded Youtube video and when I click on an tag, it changes the iframe scr to an other Youtube video. The page should not reload completely, only the iframe if needed and the src it must be able to change again by clicking a different link.

Please help if possible!

AstroCB
  • 12,337
  • 20
  • 57
  • 73
  • 3
    What have you tried? Are you familiar with modifying element attributes/properties via JavaScript? – Sampson Jan 20 '15 at 02:29
  • http://stackoverflow.com/questions/251420/invoking-javascript-code-in-an-iframe-from-the-parent-page?rq=1 this might help – Navik Hiralal Jan 20 '15 at 02:33

1 Answers1

0

You use a normal link, but its target attribute is the ID of the <iframe> you want to load it into. Example:

<a href="http://example.com/page1" target="myframe">Page 1</a>
<a href="http://example.com/page2" target="myframe">Page 2</a>

<iframe name="myframe" id="myframe"></iframe>

Of course, you will need to know the ID of the frame (if it has one) and how to format the link to insert.

rvighne
  • 20,755
  • 11
  • 51
  • 73