Rock band name generator

From Wikiid
Revision as of 10:11, 24 November 2007 by SteveBaker (Talk | contribs)

Jump to: navigation, search

<SCRIPT LANGUAGE="JavaScript">

function randN ( n ) {

 return Math.floor(Math.random()*n);

}

function percent ( n ) {

 return randN(100) < n ;

}

function band_name () {

 var message =  ;
 if ( percent(50) ) message = 'The ' ;
 var adjective = new Array ( 17 ) ;
 adjective [  0 ] = 'psychedelic ' ;
 adjective [  1 ] = 'technicolour ' ;
 adjective [  2 ] = 'amazing ' ;
 adjective [  3 ] = 'stupendous ' ;
 adjective [  4 ] = 'liquid ' ;
 adjective [  5 ] = 'electric ' ;
 adjective [  6 ] = 'luminous ' ;
 adjective [  7 ] = 'cool ' ;
 adjective [  8 ] = 'exploding ' ;
 adjective [  9 ] = 'shattered ' ;
 adjective [ 10 ] = 'magical ' ;
 adjective [ 11 ] = 'lore of the ' ;
 adjective [ 12 ] = 'Stygian ' ;
 adjective [ 13 ] = 'mystic ' ;
 adjective [ 14 ] = 'secret ' ;
 adjective [ 15 ] = 'arcane ' ;
 adjective [ 16 ] = 'punk ' ;
 var randAdj = randN ( 30 ) ;
 randAdj = randAdj % 17 ; message = message + adjective [ randAdj ] ;
 var adjective2 = new Array ( 16 ) ;
 adjective2 [  0 ] = 'blue ' ;
 adjective2 [  1 ] = 'black ' ;
 adjective2 [  2 ] = 'violet ' ;
 adjective2 [  3 ] = 'purple ' ;
 adjective2 [  4 ] = 'mauve ' ;
 adjective2 [  5 ] = 'green ' ;
 adjective2 [  6 ] = 'swingin\' ' ;
 adjective2 [  7 ] = 'rockin\' ' ;
 adjective2 [  8 ] = 'screamin\' ' ;
 adjective2 [  9 ] = 'mysterious ' ;
 adjective2 [ 10 ] = 'sinister ' ;
 adjective2 [ 11 ] = 'deadly ' ;
 adjective2 [ 12 ] = 'legendary ' ;
 adjective2 [ 13 ] = 'pentagonal ' ;
 adjective2 [ 14 ] = 'tangerine ' ;
 adjective2 [ 15 ] = 'shining ' ;
 var randAdj2 = randN ( 30 ) ;
 randAdj2 = randAdj2 % 16 ; message = message + adjective2 [ randAdj2 ] ;
 var adjective3 = new Array ( 8 ) ;
 adjective3 [ 0 ] = 'metal ' ;
 adjective3 [ 1 ] = 'iron ' ;
 adjective3 [ 2 ] = 'steel ' ;
 adjective3 [ 3 ] = 'titanium ' ;
 adjective3 [ 4 ] = 'plastic ' ;
 adjective3 [ 5 ] = 'velvet ' ;
 adjective3 [ 6 ] = 'concrete ' ;
 adjective3 [ 7 ] = 'burning ' ;
 var randAdj3 = randN ( 20 ) ;
 randAdj3 = randAdj3 % 8 ; message = message + adjective3 [ randAdj3 ] ;
 var adjective4 = new Array ( 20 ) ;
 adjective4 [  0 ] = 'stealth ' ;
 adjective4 [  1 ] = 'kamikazi ' ;
 adjective4 [  2 ] = 'surfin\' ' ;
 adjective4 [  3 ] = 'street ' ;
 adjective4 [  4 ] = 'forbidden ' ;
 adjective4 [  5 ] = 'mystery ' ;
 adjective4 [  6 ] = 'mystery' ;
 adjective4 [  7 ] = 'fried ' ;
 adjective4 [  8 ] = 'glowing ' ;
 adjective4 [  9 ] = 'rhythm ' ;
 adjective4 [ 10 ] = 'thunder ' ;
 adjective4 [ 11 ] = 'storm ' ;
 adjective4 [ 12 ] = 'voodoo ' ;
 adjective4 [ 13 ] = 'devil ' ;
 adjective4 [ 14 ] = 'hawk ' ;
 adjective4 [ 15 ] = 'guitar ' ;
 adjective4 [ 16 ] = 'war ' ;
 adjective4 [ 17 ] = 'battle ' ;
 adjective4 [ 18 ] = 'swamp ' ;
 adjective4 [ 19 ] = 'star ' ;
 var randAdj4 = randN ( 30 ) ;
 randAdj4 = randAdj4 % 8 ; message = message + adjective4 [ randAdj4 ] ;
 if ( percent ( 50 ) )
 {
   var noun = new Array ( 41 ) ;
   noun [  0 ] = 'brocolli.' ;
   noun [  1 ] = 'legend.' ;
   noun [  2 ] = 'underpants.' ;
   noun [  3 ] = 'squid,' ;
   noun [  4 ] = 'frogs,' ;
   noun [  5 ] = 'beast,' ;
   noun [  6 ] = 'death,' ;
   noun [  7 ] = 'wedgie,' ;
   noun [  8 ] = 'bunny,' ;
   noun [  9 ] = 'bunnies,' ;
   noun [ 10 ] = 'burp,' ;
   noun [ 11 ] = 'poodles.' ;
   noun [ 12 ] = 'hippoes.' ;
   noun [ 13 ] = 'gnomes.' ;
   noun [ 14 ] = 'chainsaw.' ;
   noun [ 15 ] = 'frizbee.' ;
   noun [ 16 ] = 'tomato.' ;
   noun [ 17 ] = 'nerds,' ;
   noun [ 18 ] = 'geeks.' ;
   noun [ 19 ] = 'flame.' ;
   noun [ 20 ] = 'ninjas.' ;
   noun [ 21 ] = 'elves.' ;
   noun [ 22 ] = 'army.' ;
   noun [ 23 ] = 'bunch.' ;
   noun [ 24 ] = 'band.' ;
   noun [ 25 ] = 'project.' ;
   noun [ 26 ] = 'gang.' ;
   noun [ 27 ] = 'fish.' ;
   noun [ 28 ] = 'walruses.' ;
   noun [ 29 ] = 'monkies.' ;
   noun [ 30 ] = 'pirates.' ;
   noun [ 31 ] = 'pilots.' ;
   noun [ 32 ] = 'thunder.' ;
   noun [ 33 ] = 'freaks.' ;
   noun [ 34 ] = 'wolves.' ;
   noun [ 35 ] = 'dogs.' ;
   noun [ 36 ] = 'kittens.' ;
   noun [ 37 ] = 'snake.' ;
   noun [ 38 ] = 'viper.' ;
   noun [ 39 ] = 'yodelers.' ;
   noun [ 40 ] = 'fire.' ;
   var randNoun = randN ( 41 ) ;
   message = message + noun [ randNoun ] ;
 }
 else
 {
   var noun = new Array ( 41 ) ;
   noun [  0 ] = 'brocolli ' ;
   noun [  1 ] = 'legend ' ;
   noun [  2 ] = 'underpants ' ;
   noun [  3 ] = 'squid ' ;
   noun [  4 ] = 'frogs ' ;
   noun [  5 ] = 'beast ' ;
   noun [  6 ] = 'death ' ;
   noun [  7 ] = 'wedgie ' ;
   noun [  8 ] = 'bunny ' ;
   noun [  9 ] = 'bunnies ' ;
   noun [ 10 ] = 'burp ' ;
   noun [ 11 ] = 'poodle ' ;
   noun [ 12 ] = 'hippo ' ;
   noun [ 13 ] = 'gnomes ' ;
   noun [ 14 ] = 'chainsaw ' ;
   noun [ 15 ] = 'frizbee ' ;
   noun [ 16 ] = 'tomatoes ' ;
   noun [ 17 ] = 'nerds ' ;
   noun [ 18 ] = 'geeks ' ;
   noun [ 19 ] = 'flames ' ;
   noun [ 20 ] = 'ninjas ' ;
   noun [ 21 ] = 'elves ' ;
   noun [ 22 ] = 'army ' ;
   noun [ 23 ] = 'bunch ' ;
   noun [ 24 ] = 'band ' ;
   noun [ 25 ] = 'project ' ;
   noun [ 26 ] = 'gang ' ;
   noun [ 27 ] = 'fish ' ;
   noun [ 28 ] = 'walrus ' ;
   noun [ 29 ] = 'monkey ' ;
   noun [ 30 ] = 'pirates ' ;
   noun [ 31 ] = 'pilots ' ;
   noun [ 32 ] = 'thunder ' ;
   noun [ 33 ] = 'freaks ' ;
   noun [ 34 ] = 'wolf ' ;
   noun [ 35 ] = 'dogs ' ;
   noun [ 36 ] = 'kittens ' ;
   noun [ 37 ] = 'snake ' ;
   noun [ 38 ] = 'viper ' ;
   noun [ 39 ] = 'yodelers ' ;
   noun [ 40 ] = 'fires ' ;
   var randNoun = randN ( 41 ) ;
   message = message + noun [ randNoun ] ;
   var suffix = new Array ( 25 ) ;
   suffix [  0 ] = 'from Hell.' ;
   suffix [  1 ] = 'from Outer Space.' ;
   suffix [  2 ] = 'that came from Outer Space.' ;
   suffix [  3 ] = 'from Heck.' ;
   suffix [  4 ] = 'of Doom.' ;
   suffix [  5 ] = 'of the Apocolypse.' ;
   suffix [  6 ] = 'of Destiny.' ;
   suffix [  7 ] = 'of Time.' ;
   suffix [  8 ] = 'of Rock.' ;
   suffix [  9 ] = 'reprise.' ;
   suffix [ 10 ] = 'reprisal.' ;
   suffix [ 11 ] = 'revival.' ;
   suffix [ 12 ] = 'killer.' ;
   suffix [ 13 ] = 'paradox.' ;
   suffix [ 14 ] = 'of Death.' ;
   suffix [ 15 ] = 'from the Abyss.' ;
   suffix [ 16 ] = 'in Limbo.' ;
   suffix [ 17 ] = 'of Hades.' ;
   suffix [ 18 ] = 'from beyond the grave.' ;
   suffix [ 19 ] = 'from Beyond.' ;
   suffix [ 20 ] = '3000.' ;
   suffix [ 21 ] = 'of Noise.' ;
   suffix [ 22 ] = 'from beyond the Cosmos.' ;
   suffix [ 23 ] = 'of Starship nine.' ;
   suffix [ 24 ] = 'of the third Cosmic Plane.' ;
   var randSuffix = randN ( 25 ) ;
   message = message + suffix [ randSuffix ] ;
 }
 var result = message.substring(0,1) ;
 result = result.toUpperCase () + message.substring(1,message.length);
 document.Widget.Answer.value = result ;

}

</SCRIPT>

<form name="Widget">

You rock band is called 
<input type=text name="Answer" size=80 onload="band_name()" onclick="band_name()" onblur="band_name()">

</form>


Wikiid Pages relating to JavaScript in Wiki (edit)
Centigrade/Farenheit converter
Sniffer - What can JavaScript see
Where is my mouse?
Rock band name generator