Hello and welcome to our community! Is this your first visit?
Register
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
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    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?

    Code:
    <script type="text/javascript">
    
    function stop() {
    document.getElementById("music").src = "";
    }
    </script>

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

    Code:
    <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
    Location
    London, England
    Posts
    17,919
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Try this (example):-

    Code:
    <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 07: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
    •