Jump to content

Random Text


spartan2

Recommended Posts

this little script allows you to assign a phrase or piece of text (max. 11) and then returns it from the function.

function selectRandomText() {var txt = new Array();	txt[0] = "phrase 0";	txt[1] = "phrase 1";	txt[2] = "phrase 2";	txt[3] = "phrase 3";	txt[4] = "phrase 4";	txt[5] = "phrase 5";	txt[6] = "phrase 6";	txt[7] = "phrase 7";	txt[8] = "phrase 8";	txt[9] = "phrase 9";	txt[10] = "phrase 10";// max of 10 phrasesvar num = Math.floor(Math.random()*11);// randomlly selects a phrase in the array between 0 and 10.var selected = txt[num];return selected;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...