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 4 of 4

Thread: Help needed

  1. #1
    New to the CF scene
    Join Date
    May 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help needed

    Hello!

    I am currently having some troubles finishing my website.
    www.djbobambo.com.

    I would like the music to play on every html page but the problem is that when i change a pages the music resets and begins from the beginning. I would like it to continue so when you change from page to page the music keeps playing.
    Any ideas? Thanks!

    This is the code i use:

    Code:
    <img id="music" onclick="musicfunc()" src="images/buttons/on.png" width="195" height="20" style="float: center; padding-right: 50px; padding-top: 58px;">
    <OBJECT id="MediaPlayer" width="1" height="1" style="position:absolute; left:0;top:0;" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">
    <PARAM name="URL" value="home.mp3">
    <PARAM name="AutoStart" value="True">
    <PARAM name="PlayCount" value="9999">
    </OBJECT>
    <script type="text/javascript">
    var musicstat = "1";function musicfunc(){if(musicstat == "0"){document.getElementById ('music').src="images/buttons/on.png";musicstat = "1";document.getElementById("MediaPlayer").setAttribute("URL", "home.mp3");}else if(musicstat == "1"){document.getElementById ('music').src="images/buttons/off.png";musicstat = "0";document.getElementById("MediaPlayer").setAttribute("URL", "");}}
    </script>

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,240
    Thanks
    203
    Thanked 2,554 Times in 2,532 Posts
    Quote Originally Posted by walidos22 View Post
    Hello!

    I am currently having some troubles finishing my website.
    www.djbobambo.com.

    I would like the music to play on every html page but the problem is that when i change a pages the music resets and begins from the beginning. I would like it to continue so when you change from page to page the music keeps playing.
    Any ideas? Thanks!
    Not possible AFAIK. I take it that it is the same music on each HTML page?
    If so you could try opening new pages as new windows (popups).

    You link returns a 404 error.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    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.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    629
    Thanks
    1
    Thanked 20 Times in 20 Posts
    I expect lots of objections to this solution, but ... what works, works. Here goes, anyway:

    You're asking for something to stay constant even though the page being viewed changes. Use frames. The frame which changes is set to 100% and the one which plays the music is set to "*" to take up the "rest" of the page.

  • #4
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,989
    Thanks
    56
    Thanked 557 Times in 554 Posts
    you could try getting the current position of the song at window.onbeforeunload

    Code:
    var pos=document.getElementById("MediaPlayer").Controls.currentPosition
    and passing that as a query string in the link to the next page and starting the song from that position


  •  

    Posting Permissions

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