Embedding code into a website
You can use querySelectorAll how @Pavlo says in his comment. It would work:

&lt;script type=”text/javascript”&gt;

var divsYoutube = document.querySelectorAll('div[id^="youtube"');
for(var i = 0; i &lt; divsYoutube.lenght; i++) {
 var strMessage = divsYoutube[i];
 strMessage.innerHTML = strMessage.innerHTML
                   .replace('&lt;p&gt;', '&lt;iframe ')
                   .replace('&lt;/p&gt;', '&gt;&lt;/iframe&gt;')
}

&lt;/script&gt;