Tim J wrote:
Hi all
I've got a html doc with <embed src="url.svg"> in it
however, I'd like the source to be a javscript variable (which will
depending on an if, be a different filename on loading)
is this possible and if so, what is the syntax to put a javascript variable
inside an embed tag?
thanks
window.onload= setEmbedSrc;
function setEmbedSrc(){
if (condition){
newFileName = 'someFile1.svg';
}else{
newFileName = 'someFile2.svg';
}
document.getElementById('myDeprecatedEmbedTag').sr c=newFileName;
}
<embed id="myDeprecatedEmbedTag" src="whoCaresIAmGoingToChangeItAnyway.svg">
Untested. Its Midnight, I am too lazy to test.
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq