I'm clawing my eyes out because this seems perfectly fine code, and yet it will not work. I just want a toggle to turn off some embedded music.
here's the html:
Code:
<a href="#" id="music_control" class="">MUSIC OFF</a>
<span id="music">
<embed src="http://url.com/dev/music/12_full_prom-night_0132.mp3"autostart="true" loop="true"
width="2" height="0" id="player"> <noembed> <bgsound src="http://url.com/dev/music/12_full_prom-night_0132.mp3"> </noembed>
</embed>
</span>
and here's the jquery:
Code:
$(document).ready(function() {
var playing = true;
$("#music_control").click(function(){
if (playing == false) {
playing = true;
$('music').html("<embed src='http://url.com/dev/music/12_full_prom-night_0132.mp3'autostart='true' loop='true'
width='2' height='0' id='player'> <noembed> <bgsound src='http://url.com/dev/music/12_full_prom-night_0132.mp3'> </noembed>");
$("#music_control").html("MUSIC ON");
alert(playing);
} else if (playing == true) {
playing = false;
$('music').html("<embed src='http://url.com/dev/music/12_full_prom-night_0132.mp3'autostart='false' loop='true'
width='2' height='0' id='player'> <noembed> <bgsound src='http://url.com/dev/music/12_full_prom-night_0132.mp3'> </noembed>");
$("#music_control").html("MUSIC OFF");
alert(playing);
}
});
});