Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 22nd, 2012  |  syntax: JavaScript  |  size: 6.31 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <html>
  2.         <head>
  3.                 <script language="JavaScript" type="text/javascript">
  4.                         function getWord()
  5.                         {
  6.                                 rand=Math.floor(Math.random()*(length));
  7.                                 insert = wordArray[rand][0];
  8.                                 document.getElementById("word").innerHTML=insert;
  9.                                 getChoices(rand);
  10.                         }
  11.                        
  12.                         function getRandom(rand) {
  13.                                 var rVal = Math.floor(Math.random()*(length));
  14.                                 if (rVal==rand)
  15.                                         getRandom(rand);
  16.                                 else
  17.                                         return rVal;
  18.                         }
  19.                        
  20.                         function getChoices(rand)
  21.                         {
  22.                                 ansRand = Math.floor(Math.random()*6);
  23.                                 var choices;
  24.                                 for (x=0; x<6; x++) {
  25.                                         var choice=(x==ansRand)?rand:getRandom(rand);
  26.                                         choices = choices + "<option value=\"" + x + "\">" + wordArray[choice][1] + "</option>";
  27.                                 }
  28.                                 document.getElementById("choiceDrop").innerHTML=choices;
  29.                         }
  30.                        
  31.                         function checkAnswer()
  32.                         {
  33.                                 var x=document.forms["problem"]["answer"].value;
  34.                                 var ans=wordArray[rand][1];
  35.                                
  36.                                 if (x==ansRand){
  37.                                         alert("Correct! \n" + insert + " = " + ans + ".");
  38.                                         rand = "";
  39.                                         ansRand = "";
  40.                                         choice = "";
  41.                                         choices = "";
  42.                                         insert ="";
  43.                                         getWord();
  44.                                         return;
  45.                                 }
  46.                         }
  47.                        
  48.                         var wordArray = [
  49.                                 ["abrograte","abolish"],
  50.                                 ["recline","lie down"],
  51.                                 ["abeyance","suspended action"],
  52.                                 ["haughtiness","arrogance"],
  53.                                 ["euthanasia","mercy killing"],
  54.                                 ["diffidence","shyness"],
  55.                                 ["abase","humiliate"],
  56.                                 ["accoutre","equip"],
  57.                                 ["loll","lounge about"],
  58.                                 ["eschew","avoid"],
  59.                                 ["emancipate","set free"],
  60.                                 ["abhor","detest"],
  61.                                 ["perfidious","basely false"],
  62.                                 ["diabolical","devilish"],
  63.                                 ["hubbub","confused uproar"],
  64.                                 ["Occident","the West"],
  65.                                 ["adipose","fatty"],
  66.                                 ["travail","painful labor"],
  67.                                 ["saturnine","morose; gloomy"],
  68.                                 ["suavity","urbanity; polish"],
  69.                                 ["regale","entertain"],
  70.                                 ["perimeter","outer boundary"],
  71.                                 ["credo","creed; beliefs"],
  72.                                 ["decant","pour off gently"],
  73.                                 ["accelerate","move faster"],
  74.                                 ["truncate","cut the top off"],
  75.                                 ["dilate","expand"],
  76.                                 ["physiognomy","face"],
  77.                                 ["oblivion","forgetfulness"],
  78.                                 ["psychosis","mental disorder"],
  79.                                 ["amicable","friendly"],
  80.                                 ["schism","division; split"],
  81.                                 ["tatterdemalion","ragged fellow"],
  82.                                 ["tertiary","third"],
  83.                                 ["ensue","follow"],
  84.                                 ["adept","expert at"],
  85.                                 ["turncoat","traitor"],
  86.                                 ["delete","erase"],
  87.                                 ["adhere","stick fast to"],
  88.                                 ["anthropod","manlike"],
  89.                                 ["palpitate","throb"],
  90.                                 ["arrogance","haughtiness"],
  91.                                 ["witless","foolish"],
  92.                                 ["gloaming","twilight"],
  93.                                 ["lascivious","lustful"],
  94.                                 ["derelict","abandoned"],
  95.                                 ["tepid","lukewarm"],
  96.                                 ["sundry","various, several"],
  97.                                 ["ancestry","family descent"],
  98.                                 ["bard","poet"],
  99.                                 ["censure","blame; criticize"],
  100.                                 ["conciliate","pacify; win over"],
  101.                                 ["verdant","green; fresh"],
  102.                                 ["hauter","haughtiness"],
  103.                                 ["interim","meantime"],
  104.                                 ["retraction","withdrawl"],
  105.                                 ["gaunt","thin"],
  106.                                 ["emaciated","thin; wasted"],
  107.                                 ["infallible","unerring"],
  108.                                 ["bootless","useless"],
  109.                                 ["odorous","having an odor"],
  110.                                 ["fledgling","inexperienced"],
  111.                                 ["fetter","shackle"],
  112.                                 ["definitive","final"],
  113.                                 ["conjecture","surmise; guess"],
  114.                                 ["citadel","fortress"],
  115.                                 ["cortege","procession"],
  116.                                 ["affray","public brawl"],
  117.                                 ["psyche","soul; mind"],
  118.                                 ["fancied","imagined"],
  119.                                 ["unsullied","untarnished"],
  120.                                 ["aspiration","noble ambition"],
  121.                                 ["protrude","stick out"],
  122.                                 ["mimicry","imitation"],
  123.                                 ["abash","embarrass"],
  124.                                 ["exigency","urgent situation"],
  125.                                 ["amnesia","loss of memory"],
  126.                                 ["machinations","schemes"],
  127.                                 ["remiss","negligent"],
  128.                                 ["exchequer","treasury"],
  129.                                 ["celestial","heavenly"],
  130.                                 ["analogous","comparable"],
  131.                                 ["portly","stately; stout"],
  132.                                 ["hogshead","large barrel"],
  133.                                 ["pedigree","ancestry; lineage"],
  134.                                 ["impregnable","invulnerable"],
  135.                                 ["misgivings","doubts"],
  136.                                 ["animated","lively"],
  137.                                 ["amulet","charm"],
  138.                                 ["anathema","solemn curse"],
  139.                                 ["admonition","warning"],
  140.                                 ["acumen","mental keenness"],
  141.                                 ["animadversion","critical remark"],
  142.                                 ["fervid","passionate"],
  143.                                 ["ardent","passionate"],
  144.                                 ["jubilation","rejoicing"],
  145.                                 ["meretricious","flashy"],
  146.                                 ["tawdry","flashy"],
  147.                                 ["abrogate","abolish"],
  148.                                 ["inter","bury"],
  149.                                 ["ablution","washing"],
  150.                                 ["unwonted","unaccustomed"],
  151.                                 ["insipid","tasteless"],
  152.                                 ["lucent","shining"],
  153.                                 ["vacuous","empty"],
  154.                                 ["inane","empty"],
  155.                                 ["wily","cunning; artful"],
  156.                                 ["commensurate","equal in extent"],
  157.                                 ["abominate","loathe: hate"],
  158.                                 ["gingerly","very carefully"],
  159.                                 ["impious","irreverent"],
  160.                                 ["annul","make void"],
  161.                                 ["finesse","delicate skill"],
  162.                                 ["dappled","spotted"],
  163.                                 ["lank","long and thin"],
  164.                                 ["evince","show clearly"],
  165.                                 ["swill","drink greedily"],
  166.                                 ["interdict","prohibit; forbid"],
  167.                                 ["expunge","cancel; remove"],
  168.                                 ["vestige","trace; remains"],
  169.                                 ["reprove","express severe disapproval"],
  170.                                 ["censure","express severe disapproval"],
  171.                                 ["rebuke","express severe disapproval"],
  172.                                 ["lithe","flexible; supple"],
  173.                                 ["depreciate","lessen in value"],
  174.                                 ["immaculate","pure; spotless"],
  175.                                 ["brusque","blunt; abrupt"],
  176.                                 ["valetudinarian","invalid"],
  177.                                 ["foster","rear; encourage"],
  178.                                 ["paucity","scarcity"],
  179.                                 ["frolicsome","prankish; gay"],
  180.                                 ["turpitude","depravity; meanness"],
  181.                                 ["shackle","fester; chain"],
  182.                                 ["astute","shrewd; wise"],
  183.                                 ["disheveled","untidy"],
  184.                                 ["ominous","threatening"],
  185.                                 ["abash","embarrass"],
  186.                                 ["irrevocable","unalterable"],
  187.                                 ["swindler","cheater"],
  188.                                 ["convoke","call together"],
  189.                                 ["abeyance","suspended action"],
  190.                                 ["indefatigable","tireless"],
  191.                                 ["histrionic","theatrical"],
  192.                                 ["accede","agree"],
  193.                                 ["virile","manly"],
  194.                                 ["reek","emit odor"],
  195.                                 ["badger","pester; annoy"],
  196.                                 ["salubrious","healthful"],
  197.                                 ["extol","praise; glorify"],
  198.                                 ["incommodious","not spacious"],
  199.                                 ["accord","agreement"],
  200.                                 ["eminent","high; lofty"],
  201.                                 ["fiat","command"]
  202.                         ];
  203.                        
  204.                         length = wordArray.length;
  205.                 </script>
  206.         </head>
  207.        
  208.         <body>
  209.                 <form name="problem" method="post">
  210.                         <span id="word"></span>
  211.                         <select name="answer" id="choiceDrop">
  212.                                
  213.                         </select>
  214.                         <input type="button" value="check" onclick="checkAnswer()">
  215.                 </form>
  216.  
  217.         <script type="text/javascript">
  218.                 getWord();
  219.         </script>
  220.         </body>
  221. </html>