How do you make a random button?

Discussion in 'General Chat' started by LavaEagle, Mar 21, 2009.

  1. LavaEagle

    LavaEagle New Member

    Joined:
    Aug 12, 2008
    Messages:
    416
    Likes Received:
    0
    I need some tutorial or code that will help me make a button that will give me a button that will take me to a random link!

    -I think I found one....


    Code:
    <!--
    /*
    Random link button- By JavaScript Kit (http://javascriptkit.com)
    Over 300+ free scripts!
    This credit MUST stay intact for use
    */
    
    //specify random links below. You can have as many as you want
    var randomlinks=new Array()
    
    randomlinks[0]="http://freewarejava.com"
    randomlinks[1]="http://javascriptkit.com"
    randomlinks[2]="http://dynamicdrive.com"
    randomlinks[3]="http://cnn.com"
    randomlinks[4]="http://www.geocities.com"
    
    function randomlink(){
    window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)]
    }
    //-->
    </script>
    <form>
    <p><input type="button" name="B1" value="Random Link >>" onclick="randomlink()"><p></p> </form>
    
    <!--Uncomment below to use a regular text link instead
    <a href="javascript:randomlink()">Random Link</a>
    -->[code]
     
  2. Whitefang

    Whitefang ( ͡° ͜ʖ ͡°)

    Joined:
    Jul 12, 2008
    Messages:
    4,009
    Likes Received:
    43
    So you found one.
     
  3. LavaEagle

    LavaEagle New Member

    Joined:
    Aug 12, 2008
    Messages:
    416
    Likes Received:
    0
    I wanted to know if there was a simpler one....
     
  4. Zeke

    Zeke [BB] Sub Admin Sub Admin

    Joined:
    May 2, 2008
    Messages:
    4,209
    Likes Received:
    12
    I would help but people pay for this.
     
  5. LavaEagle

    LavaEagle New Member

    Joined:
    Aug 12, 2008
    Messages:
    416
    Likes Received:
    0
    God damn your retarded nvm mind i found a free script that works perfectely fine.
     
  6. Zeke

    Zeke [BB] Sub Admin Sub Admin

    Joined:
    May 2, 2008
    Messages:
    4,209
    Likes Received:
    12
    No problem