PDA

View Full Version : A little help with using JavaScript to control an embedded media player



37637598
16 Sep 2008, 01:31 PM
A little help with using JavaScript to control an embedded media player

I guess I'll just lay out what I have so far.


This code should insert HTML inside the span ID 'Song' tags. The reason it says : "innerHTML = play;", is that 'play' is a variable that's saved within the songvars.js file, which can be viewed at the bottom of this post.

<script src="songvars.js" type="text/javascript">
function update(){
document.getElementById('Song').innerHTML = play;
}
</script>


This is the button that when pressed, will activate the function 'update' and replace the HTML within the 'span' tags.

<a href="javascript:;" onclick='update()'>Another Rainy Day</a>


This is the span. As you can see, there is no HTML inside of it.

<span id="Song"></span>



This is the 'songvar.js' file. As you can see, var 'play' = MediaPlayer1, and MediaPlayer1 is the object within the file.

var play=MediaPlayer1
<object id="MediaPlayer1"
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
data="123456"
type="application/x-oleobject"
width=380
height=50
align="middle"
standby="Loading Microsoft&reg; Windows&reg; Media Player components...">

<param name="FileName" value="ANOTHERRAINYDAY.mp3">
<param name="AutoStart" value=CurrentSong>
<param name="ShowStatusBar" value="True">
<param name="DefaultFrame" value="mainFrame">
<param name="PlayList" value="Enable">
</object>




In my mind, this is how it should work:

user clicks on Another Rainy Day button, the button triggers the JavaScript function "update". Update then replaces the html within the span tags ID'd 'Song', with the variable 'play', which within the songvars.js file, variable 'play' should be read as MediaPlayer1, because I have a line of code within the songvares.js file that says play=MediaPlayer1.


Any help is much appreciated.
The script when finished, will load the media player when the button is pressed. The reason I need this code, is so when a user clicks a song name from my song list, it will load a player with that song name embedded.

I tried just wrapping span tags around the param filename="ALONEINSHAME" tag, and having the update function change the innerHTML to a different song name, but I still get the same result.

What result do I get???

Nothing happens, and I get the little error icon in the bottom corner of the screen.


Thanks!

-Vnnie

Lyly
22 Sep 2008, 07:37 PM
Has anyone ever seen this knife before and can it really be used on a bayonet? It is said that it can fit together with a AK47 rifle. Maybe it is a copy of some old military knife that was used back in one of the wars? The website that it is on is www.lducompany.com I am wondering if it can fit on any other types of guns or rifles. Does it look like something that would be used by Chinese, Koreans, or Russians. Here is a link to the knives page http://www.liangdianup.com/knives_1.htm and it is the knife with the number 406023 right at the top of the page.Any help would be appreciated before I order it all the way from China :)
:wave: