Hi there I've been using a piece of code accross a number of my sites for a while that toggles displayed images by changing the src of an img tag. I assumed it would work fine with the embed tag too, but it seems it doesn't. Any ideas? //on head: function loadmov(moviename) { document.embeds['movieid'].src = ("../path/"+ moviename); focus(); } //on icon: onClick="loadmov('mymovie')" Code (markup):
you can make it this way: then you have to declare the variable (I assume you kno how....otherwise ask or google) and remember that you have to escape all special characters...read more here: www.zend.com/zend/tut/using-strings.php greets
Thanks a lot for your reply. Could you explain a little more? Why do I need to use php to declare the filename- I don't really understand why it doesn't work in the same way as it does for the img tag. Any help would be really appreciated!
Oh I think I missunderstood your needs...with the word dynamically I thought you wanted to display something depending on which site you are for example without always having to rewrite the embed tag etc... Can you explain the problem once again a little better? greets
I stumbled on this thread from a web search. I think he was trying to do the same thing I'm trying to do, and that is to duplicate the effect of the target attribute in an anchor tag. For example, you can "embed" a movie in a page using an iframe, then have links on the page to watch different clips & have them open in the iframe simply by setting the target attribute to target the iframe's ID. Unfortunately, neither embed nor object tags can be targetted in such a way. To achieve the same effect with an embed or object tag, you need to use javascript to change the src attribute of the embed tag when you click the appropriate link. I have found a few snippets of code online that -should- work for this, but can't get any to actually work. Here's a sample page I've uploaded, the 2 "test" links are the codes I've grabbed from the web. ht-tp://allspark.net/cypherswipe/js-embed-src.html Absolutely nothing happens when I click either test link. As you can tell from the other links on the page, I was originally using an iframe tag + target attributes. That no longer works however, as when you try to view the vids directly, the player is downloaded instead of playing in the browser (it appears that mogulus is now delivering the player with a binary/octet mime type, which causes the browser to save it unless it's embedded in an embed or object tag). This is for a local file for my own use btw, so it has to be javascript, not anything server-side like php.