![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 141 Pomógł: 0 Dołączył: 9.10.2015 Ostrzeżenie: (0%) ![]() ![]() |
Witajcie, jak zrobić, że gdy wkleję w input link do filmiku youtube to nad tym inputem pojawi się iframe z filmikiem.
Przykład iframe . Podacie przykład jak to zrobić? |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 286 Pomógł: 46 Dołączył: 10.01.2016 Ostrzeżenie: (0%) ![]() ![]() |
Kod function addElement () { // create a new div element // and give it some content var newDiv = document.createElement("iframe"); newDiv.setAttribute('width',560); newDiv.setAttribute('height',315); newDiv.setAttribute('src',document.getElementById('text').value); newDiv.setAttribute('frameborder',0); newDiv.setAttribute('allowfullscreen','allowfullscreen'); newDiv.setAttribute('id','divek'); var newContent = document.createTextNode("Hi there and greetings!"); newDiv.appendChild(newContent); //add the text node to the newly created div. // add the newly created element and its content into the DOM var currentDiv = document.getElementById("div1"); document.body.insertBefore(newDiv, currentDiv); } function removeElement(){ document.getElementById('divek').remove(); } document.getElementById('btn').addEventListener('click',addElement,false); document.getElementById('btn2').addEventListener('click',removeElement,false); Template: https://developer.mozilla.org/en-US/docs/We...t/createElement |
|
|
![]() ![]() |
![]() |
Aktualny czas: 15.10.2025 - 03:22 |