Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Cowboy Nation
    Thanked 257 Times in 257 Posts

    On/Off button not working (forgive me)

    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.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,573 Times in 2,551 Posts
    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.
    Last edited by Philip M; 12-09-2011 at 08:51 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts