Music Script, On/Off, Cookies, Images

Discussion in 'Web Design & Coding' started by madmatt, Jun 8, 2006.

  1. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    Okay, I give up. I'm lost.

    A client of mine wants music on her site. I told her she should provide the user with an on/off button that will remember their selection (stupid me -- I thought it would be easier).

    I have the two images (GIF) and the song (MP3), but that's as far as I've gotten.

    When the music is playing I need it to show the music on image. When it is off I need it to show the muted image. I need this script to work using cookies so the script will remember if the user wants to hear the music.

    Hopefully you know what I mean. Thank you.
     
  2. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Take a look at the collapser I made for the front page last week: http://osnn.net/collapser.js

    I think it's along the same lines as what you want, however I wouldn't know how to stop the music once it's playing (dependant on the embedding method, that is).

    Hope that helps some.


    Edit: There's also the simpler version of the script available here, http://speedyb.osnn.net/simple_hidy.html
     
    Last edited: Jun 8, 2006
  3. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    I'll take a look, thank you.

    I'm making some progress. If I could figure out how to make the stupid thing loop, work with cookies, and change the image. That script should help with the latter two.
     
  4. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
  5. madmatt

    madmatt Bow Down to the King Political User

    Messages:
    13,312
    Location:
    New York
    Dave, I am using a different method (similar), but this method doesn't require the ActiveX control.

    There is no "loop" property, only a "playCount" property. So, I set it to 1000. A value of 0 is supposed to make it loop but that isn't working.

    I figured out the images too using JavaScript.

    Last thing is the cookies.
     
  6. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Just use document.cookie(); in the same function/block you're changing the images :)