Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Anyone Knows How To Make A Stop Background..

  1. #1
    I have made a homepage with random background music but sometimes I want to turn the background music off cause I am listening to something else,

    I know that I can just hit the stop button which is next to the "Refresh" button but I have made my own picture which I would like to use as a "on/off" button.

    This is the random background script I have:
    Code:
    <script>
    <!--
    //By JavaScript Kit (http://www.javascriptkit.com) More JavaScripts here!
    var sound1="sound/onestepcloser.mid"
    var sound2="sound/again.mid"
    var sound3="sound/waitand.mid"
    var sound4="sound/changes.mid"
    var sound5="sound/crawling.mid"
    var x=Math.round(Math.random()*4)
    if (x==0) x=sound1
    else if (x==1) x=sound2
    else if (x==2) x=sound3
    else if (x==3) x=sound4
    else x=sound5
    if (navigator.appName=="Microsoft Internet Explorer")
    document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
    else 
    document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true" loop="true">')
    //-->
    </script>
    Now I just want to have a ON/OFF button but I would like to use my own picture as button.

  2. Software & Hardware   -   #2
    shouldn't this be better of in softwareworld or development?
    I think you'll get more replies than in the lounge.

  3. Software & Hardware   -   #3
    Originally posted by ~FunK_mOb~@13 November 2003 - 20:09
    shouldn't this be better of in softwareworld or development?
    I think you'll get more replies than in the lounge.
    I dont know, I dont think this has anything with software or development to do.

  4. Software & Hardware   -   #4
    Ex-member
    Join Date
    Jan 2003
    Posts
    5,450
    It is software-related, so it's going there.

    Personally, I wouldn't use background music in a webpage - it's supremely annoying.

  5. Software & Hardware   -   #5
    SniperInTheShadows's Avatar Poster
    Join Date
    Jan 2003
    Location
    See below ;)
    Posts
    605
    I know this is not the perfect solution to the problem, but if you can't find out how to make your stop button work then perhap's you could just make a small and empty .wav file which the stop button play's once and then stops instead to make it act like a stop button?

    Sniper.

    EDIT : Got distracted by the tele and forgot the "." on ".wav" lol

  6. Software & Hardware   -   #6
    That script is junk. I would prefer writing my own.
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  7. Software & Hardware   -   #7
    Give me few mins
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  8. Software & Hardware   -   #8
    Code:
    &#60;script&#62;
    
    // Written by I.am 
    // for Crack man coz he was using junk script
    //****Script****--&#62;
    var numberofmid = 2
    day = new Date&#40;&#41;
    myseed = day.getTime&#40;&#41;
    random = parseInt&#40;&#40;&#40;myseed - &#40;parseInt&#40;myseed/1000,10&#41; * 1000&#41;&#41;/10&#41;/100*numberofmid + 1,10&#41;
    
    if&#40;random== &#40;1&#41;&#41;
    midi = &#40;&#34;soundsrcfile1.mid&#34;&#41;
    if&#40;random==&#40;2&#41;&#41;
    midi = &#40;&#34;soundsrcfile2.mid&#34;&#41;
    if&#40;random == &#40;3&#41;&#41;
    midi = &#40;&#34;soundsrcfile3.mid&#34;&#41;
    
    //Make sure to put the right value in numberofmid. If you have 10 mid files then initialize numberofmid = 10
    //Add as many random files you want. Increase random by 1 and keep adding the source files.
    
    document.write&#40;&#39;&#60;EMBED SRC= &#34;&#39; + midi + &#39;&#34; WIDTH=200 HEIGHT=55 AUTOSTART=TRUE&#62;&#39;&#41;
    document.write&#40;&#39;&#60;BGSOUND SRC= &#34;&#39; + midi + &#39;&#34; loop=infinite AUTOSTART=TRUE&#62;&#39;&#41;
    //&#60;--End of Script, By I.am
    
    &#60;/SCRIPT&#62;
    Copy it to your page. In place of soundsrcfile give the path to your mid file.

    B)
    I.am

    ps: Btw, this will be truly random. Almost impossible to predict which mid will be played as compared to that simple Math.random() function.

    Second Edit: I forgot to mention what this will do. It will have a player on your page where you can control your mid. Play, Pause, Stop, Forward etc. all in there inbuilt.
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  9. Software & Hardware   -   #9
    Originally posted by I.am@14 November 2003 - 01:19
    Code:
    &#60;script&#62;
    
    // Written by I.am 
    // for Crack man coz he was using junk script
    //****Script****--&#62;
    var numberofmid = 2
    day = new Date&#40;&#41;
    myseed = day.getTime&#40;&#41;
    random = parseInt&#40;&#40;&#40;myseed - &#40;parseInt&#40;myseed/1000,10&#41; * 1000&#41;&#41;/10&#41;/100*numberofmid + 1,10&#41;
    
    if&#40;random== &#40;1&#41;&#41;
    midi = &#40;&#34;soundsrcfile1.mid&#34;&#41;
    if&#40;random==&#40;2&#41;&#41;
    midi = &#40;&#34;soundsrcfile2.mid&#34;&#41;
    if&#40;random == &#40;3&#41;&#41;
    midi = &#40;&#34;soundsrcfile3.mid&#34;&#41;
    
    //Make sure to put the right value in numberofmid. If you have 10 mid files then initialize numberofmid = 10
    //Add as many random files you want. Increase random by 1 and keep adding the source files.
    
    document.write&#40;&#39;&#60;EMBED SRC= &#34;&#39; + midi + &#39;&#34; WIDTH=200 HEIGHT=55 AUTOSTART=TRUE&#62;&#39;&#41;
    document.write&#40;&#39;&#60;BGSOUND SRC= &#34;&#39; + midi + &#39;&#34; loop=infinite AUTOSTART=TRUE&#62;&#39;&#41;
    //&#60;--End of Script, By I.am
    
    &#60;/SCRIPT&#62;
    Copy it to your page. In place of soundsrcfile give the path to your mid file.

    B)
    I.am

    ps: Btw, this will be truly random. Almost impossible to predict which mid will be played as compared to that simple Math.random() function.

    Second Edit: I forgot to mention what this will do. It will have a player on your page where you can control your mid. Play, Pause, Stop, Forward etc. all in there inbuilt.
    I appreciate that you trying to help me but as I said,I would like to use my own button I have made which I can just turn on/off music.

  10. Software & Hardware   -   #10
    Well this was the more efficient method. However, as someone else suggested you can have a blank midi and just call that midi when you click stop button. Make another function stop() and call midi in that. Call the stop() on click of the button.
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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