View Full Version : music on page with stop button

04-03-2008, 01:40 PM
hi, i'm trying to have music autoplay on a page with a button to stop or pause it. is there a way to make this work with the code below? if not, can someone recommend another piece of code that would work that uses a linked piece of text to stop the music? i'm not interested in having an embed player come up on the page.
thanks much!
ps- please save the autoplay music debate, this is what the client has asked for ;)

<script type="text/javascript"><!--
function play(what){
document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+what+"' name='MediaPlayer1' width='0' height='0' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true' loop='false' ></embed>";
function stopsong(){


<div id="music">music <a href="mp3/somefile.mp3" class="blue" onclick="play(this.href);return false">ON</a> / <a href="#" class="blue" onclick="stopsong();return false">OFF</a></div><span id="music1"></span>

04-03-2008, 01:54 PM
sorry, this has already been answered here....