View Full Version : On/Off button not working (forgive me)

12-08-2011, 10:34 PM
I know it's a cardinal sun, but I have background music on a sub site for my company. I need to be able to turn it on and off. It doesnt seem to work. Can anyone take a second to look at my code and see what might be the issue?

<script type="text/javascript">

function stop() {
document.getElementById("music").src = "";

<a href="javascript:stop()" >
<img name="_stp_gfx" src="images/_stp_gfx.jpg" width="121" height="55" border="0" id="_stp_gfx" alt="" />

<embed name="music" src="_media/12_8_media.mp3" id="music" autostart="false" loop="false" hidden="true">

Thanks for any help.

Philip M
12-09-2011, 08:34 AM
Try this (example):-

<p align="right"><font face="Arial" size="1"><a href="javascript:document.embeds['musicfile'].stop()">Stop Music</a></p>

<EMBED src="thelocomotion.mid" name="musicfile" volume="-800" autostart="true" hidden="true">

This works in IE but check for browser compatibility.

<EMBED ...> is not a part of the HTML 4 or xHTML 1 specifications, but it is still widely supported by modern browsers. Unlike other tags, the
attributes used by <EMBED ...> depend on the type of plugin being used (this odd free-attribute concept is why <EMBED ...> has been rejected by
the HTML standards makers).

Quizmaster: What season is said to start on the longest day in December?
Contestant: Spring.
Quizmaster: December, for God's sake!
Contestant: Summer.