Some help with some codes...

  • 7,901
    Posts
    21
    Years
    Okay... er... so...
    Can someone please provide me an HTML code where the webpage plays a random background music everytime you refresh it?

    Much thanks in advance! ^__^
     
    Goes in Webmaster's Resources.
    ~*Moves
    I'm not sure if there's an HTML code that plays random music each time. You may need to do that in PHP which I wouldn't know how to make it random. I don't even know the HTML code that is W3C compliant that plays music. Someone else will though.
     
    Code:
    <EMBED SRC='midis/<? echo("rand(1,10)"); ?>.midi' AUTOSTART='TRUE' WIDTH='144' HEIGHT='60' CONTROLS=Console>

    upload the midis in a folder called midis. feel free to change the 1,10 values to your needs
     
    Well, then, I guess you can't have music @_@

    This would be for your blog then...
     
    Oh! I see... hold on...

    Here's it is:

    <script language="JavaScript"><!--
    ctips = new Array(7);
    ctips[1]="Song-Name";
    ctips[2]="Song-Name";
    ctips[3]="Song-Name";
    ctips[4]="Song-Name";
    ctips[5]="Song-Name";
    ctips[6]="Song-Name";
    ctips[7]="Song-Name";
    ctips[8]="Song-Name";
    ctips[9]="Song-Name";
    ctips[10]="Song-Name";

    tips = new Array(7);
    tips[1]=" SONG LINK";
    tips[2]="SONG LINK ";
    tips[3]="SONG LINK";
    tips[4]="SONG LINK";
    tips[5]="SONG LINK"
    tips[6]="SONG LINK"
    tips[7]="SONG LINK"
    tips[8]="SONG LINK"
    tips[9]="SONG LINK"
    tips[10]="SONG LINK"

    index=Math.floor(Math.random() * tips.length);
    document.write("<center><embed src="+tips[index]+" width=0 height=0 align=top autostart=true loop=true controls=hidden type=audio/x-pn-realaudio-plugin exts=ra,ram Init fn=load-types mime-types=mime.types></embed></center>")
    document.write("<center><font color=#000000>"+ctips[index]+"</center>")
    //-->
    </script>
     
    I coulda helped you with less work... I can give you a shorter code. But if they're not MIDIs, I hereby FORBID you to use them~ other file types take WAY too long to download~ and background music is annoying, at least put in a control to turn it off...
     
    Back
    Top