Web Analytics Made Easy -
StatCounter Background music - CodingForum


No announcement yet.

Background music

  • Filter
  • Time
  • Show
Clear All
new posts

  • Background music

    Hi everybody,
    I have to embed a musical background to a web site. I have found a script, and they gave me the music file. Is there a simple way to have this music play for all the web pages continuously?
    Thanks to all of you

    Here is the script

    var musicsrc="cosmic.mp3"
    if (navigator.appName=="Microsoft Internet Explorer")
    document.write('<bgsound src='+'"'+musicsrc+'"'+' loop="infinite">')
    document.write('<embed src=\"'+musicsrc+'\" hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')

  • #2
    Does your site use frames?
    If it does that would be cool because then you could just add that script to the frame that shoes all of the time. That would solve your problem. If not. I have no idea unless you popup a window and hope the people will not close it. That might be another Idea though. You could popup a window that has a play and stop button etc. Have fun!
    I try to convince 'em that I am computer geek, but I just can't do it. Why? Oh why?


    • #3
      Great idea, I did not think of frames!!
      At least this solves half the problem. Thank you MikoLone


      • #4
        How to modify provided music script?

        The music script provided is very useful! Thanks!

        I was wondering how to do two different modifications to this script:

        1) Provide a toggle to turn the music on and off.

        2) If NOT using frames, and the user turns the music off (or back on) on one page, then navigates to another page on the same site, what's the best way to have the user's last selected music play choice (i.e. off or on) take effect on the new page? Does this get into cookies? Or is there an easier way to track this?