...

View Full Version : Changing object and embed



Yorick
07-09-2006, 05:29 PM
Ok, i've got a site were a lot off radio stations are put together. Now I wan't to simply change the player to play a other station with a klik.

The code looks this way:

<object id="mediaplayer" width=351 height=64 classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" standby="" type="application/x-oleobject">
<param name="url" value="http://www.slamfm.nl/stream/slamfm.asx">
<param name="invokeurls" value="false">
<param name="autostart" value="true">
<param name="uimode" value="mini">
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/mediaplayer/" src="http://www.slamfm.nl/stream/slamfm.asx" name="mediaplayer" width=351 height=64 showstatusbar=1 autostart=1 invokeurls=0></embed>
</object>

So I was thinking to put a wrapper around the thing I wanna change and change the innerHTML, this is what i've got:

<html>
<head>
<title>Songtastic Jukemeister</title>
<script>
function changeStation(station){

var element = document.getElementById('station_wrapper_value');
element.innerHTML = '<param name="url" value="' + station + '">';

var element = document.getElementById('station_wrapper_src');
element.innerHTML = '<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/mediaplayer/" src="' + station + '" name="mediaplayer" width=351 height=64 showstatusbar=1 autostart=1 invokeurls=0></embed>';

}

}
</script>
<body>
<object id="mediaplayer" width=351 height=64 classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" standby="" type="application/x-oleobject">
<div id="station_wrapper_value">
<param name="url" value="http://www.slamfm.nl/stream/slamfm.asx">
</div>
<param name="invokeurls" value="false">
<param name="autostart" value="true">
<param name="uimode" value="mini">
<div id="station_wrapper_src">
<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/mediaplayer/" src="http://www.slamfm.nl/stream/slamfm.asx" name="mediaplayer" width=351 height=64 showstatusbar=1 autostart=1 invokeurls=0></embed>
</div>
</object>

<a href="javascript:changeStation('http://www.garnierstreamingmedia.com/asx/veronicaradio.asp');">Radio 538</a>
</body>
</html>

But for some reason it doesn't work, does somebody has an idea what I did wrong?

Thanks in advance,

_Aerospace_Eng_
07-09-2006, 06:35 PM
Use the code in this post http://www.codingforums.com/showpost.php?p=460601&postcount=503



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum