32 users online (1 members and 31 guests)  


  Results 1 to 2 of 2
  1. #1
    skye ravynne's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2002
    Posts
    8

    Angry The Tears are FLOWING.............

    Ok........not literally, but I got your attention.

    Dean........I have hunted and hunted on that site.
    I cant find anything specific on background music
    much less how to let the user pick their own.

    SIGH

    I know you probaly cant stand the sight of a crying woman, so consider that when you are reading this.



    Heavily Frustrated and going to look for some Valum (kidding)

    Skye

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    lol. Okey, lets have a play...

    I am assuming that you know how to set a cookie.

    I am also assuming that the cookie information you sent was the filename of the song to be played. Lets say I got a cookie called romance.mid .

    I would write some JavaScript to call the correct file like this -

    Code:
    <script language="JavaScript">
    document.cookie = "songName=romance.mid";
    
    function getCookie(name) {
      var dc = document.cookie;
      var prefix = name + "=";
      var begin = dc.indexOf("; " + prefix);
      if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
      } else
        begin += 2;
      var end = document.cookie.indexOf(";", begin);
      if (end == -1)
        end = dc.length;
      return unescape(dc.substring(begin + prefix.length, end));
    }
    
    var cookster = getCookie('songName');
    
    document.write('<embed src="' + cookster + '" loop=true display=false>');
    </script>
    <input type="button" onClick="alert(cookster)" value="test Cookie is enabled">
    Thats a stand-alone, test script. Just remove the section that sets the cookie.

    Setting a cookie is as easy as -

    Code:
    <input type="button" value="Romance" onClick="document.cookie = 'songName=romance.mid'>
    Have fun with that
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread