DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   how to change the the value of src in <embed> using javascript (http://www.daniweb.com/forums/thread16626.html)

odee Jan 7th, 2005 7:33 am
how to change the the value of src in <embed> using javascript
 
need help here. how can i change the src in <embed> using javascript that works in firefox?

ex.

<embed src="music.mid">

- how can i change "music.mid" to another midi file.

tgreer Aug 31st, 2006 11:29 am
Re: how to change the the value of src in <embed> using javascript
 
First, I don't work much with embeds, so this is speculation. But you need to give your element an ID, as such:

<embed id="myMidi" src="music.mid">
Then, you can get to the object using document.getElementById("myMidi"). At that point, try simply changing the source:

 document.getElementById("myMidi").src = "newfile.mid";

hari123 Sep 1st, 2006 2:21 am
Re: how to change the the value of src in <embed> using javascript
 
<embed id="myMidi" src="music.mid">
document.getElementById("myMidi").src = "newfile.mid";

Hi, I already use this case but the embed object c'not accept the src.
there is my problem.

tgreer Sep 1st, 2006 11:27 am
Re: how to change the the value of src in <embed> using javascript
 
The "embed" tag may not allow that. What you may have to do instead is place the tag into a div, and then use JavaScript to completely rewrite the contents of the div. Research ".innerHTML".


All times are GMT -4. The time now is 11:47 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC