Link to home
Start Free TrialLog in
Avatar of skylabel
skylabel

asked on

multiple links that plays video in embedded windows media player when clicked

<HTML><HEAD></HEAD>
<BODY>
<OBJECT ID='Player' width='320' height='240' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>
<PARAM name='autoStart' value='True'>
<PARAM name='URL' value='http://www.mydoman.com/intro.asx'>
</OBJECT>

<SCRIPT LANGUAGE='JavaScript'>
     Player.settings.setMode('loop',true);
</SCRIPT>
</BODY></HTML>

The above code is used to embed a windows media player and loop a pre-determined video clip. It works fine. However, I want many links on the page, and depending on which link is pressed, the relevant movie should be played (on the same media player). So I tried to stick all the stuff between the object tags into a javascript function in the header section of the html page like so, but I'm stuck really early on.....

<script language="JavaScript">
function playvdo()   {

document.write ("<OBJECT ID='Player' width='320' height='240'  CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'><PARAM name='autoStart' value='True'><PARAM name='URL' value='http://www.citybroadcast.tv/intro.asx'></OBJECT>");

Player.settings.setMode("loop",true);
}
</script>

and I have a link like this to call the function : <a href="javascript:playvdo()">Click Me</a>

Now, there's something wrong already. I can't get even one video clip to work, let alone having multiple choices. Can someone help? Greatly Appreciated thanks.
ASKER CERTIFIED SOLUTION
Avatar of Timbo87
Timbo87

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of skylabel
skylabel

ASKER

You're a genius and I'm an idiot...
works great. Thanks.
i have a problem with this..i mean it works only when i preview it but when i save it and view it on my webpage the media players gone help?
could you show the entire code of how to make it work? i have a similar problem and i am trying to use this code, but is not working

thanks!