topical media & game development

talk show tell print

game-javascript-casual-where-born-game.htm / htm



  
  <!-- TWO STEPS TO INSTALL WHERE BORN?:
  
     1.  Put the designated coding into the HEAD of your HTML document
     2.  Paste the last code into the BODY of your HTML document  -->
  
  <!-- STEP ONE: Copy this code into the HEAD of your HTML document  -->
  
  <HEAD>
  
  <SCRIPT LANGUAGE="JavaScript">
  
  <!-- This script and many more are available free online at -->
  <!-- The JavaScript Source!! http://javascript.internet.com -->
  
  <!-- Begin
  function makeArray(n) {
  this.length = n
  for (var i=1; i <= n; i++)
  this[i] = null
  return this
  }
  var ssn = new makeArray(57)
  ssn[1] = 3
  ssn[2] = 7
  ssn[3] = 9
  ssn[4] = 34
  ssn[5] = 39
  ssn[6] = 49
  ssn[7] = 134
  ssn[8] = 158
  ssn[9] = 211
  ssn[10] = 220
  ssn[11] = 222
  ssn[12] = 231
  ssn[13] = 236
  ssn[14] = 246
  ssn[15] = 251
  ssn[16] = 260
  ssn[17] = 267
  ssn[18] = 302
  ssn[19] = 317
  ssn[20] = 361
  ssn[21] = 386
  ssn[22] = 399
  ssn[23] = 407
  ssn[24] = 415
  ssn[25] = 424
  ssn[26] = 428
  ssn[27] = 432
  ssn[28] = 439
  ssn[29] = 448
  ssn[30] = 467
  ssn[31] = 477
  ssn[32] = 485
  ssn[33] = 500
  ssn[34] = 502
  ssn[35] = 504
  ssn[36] = 508
  ssn[37] = 515
  ssn[38] = 517
  ssn[39] = 519
  ssn[40] = 520
  ssn[41] = 524
  ssn[42] = 525
  ssn[43] = 527
  ssn[44] = 529
  ssn[45] = 530
  ssn[46] = 539
  ssn[47] = 544
  ssn[48] = 573
  ssn[49] = 574
  ssn[50] = 576
  ssn[51] = 579
  ssn[52] = 580
  ssn[53] = 584
  ssn[54] = 585
  ssn[55] = 586
  ssn[56] = 599
  ssn[57] = 728
  var geo = new makeArray(57)
  geo[1] = "New Hampshire"
  geo[2] = "Maine"
  geo[3] = "Vermont"
  geo[4] = "Massachusetts"
  geo[5] = "Rhode Island"
  geo[6] = "Connecticut"
  geo[7] = "New York"
  geo[8] = "New Jersey"
  geo[9] = "Pennsylvania"
  geo[10] = "Maryland"
  geo[11] = "Delaware"
  geo[12] = "Virginia"
  geo[13] = "West Virginia"
  geo[14] = "North Carolina"
  geo[15] = "South Carolina"
  geo[16] = "Georgia"
  geo[17] = "Florida"
  geo[18] = "Ohio"
  geo[19] = "Indiana"
  geo[20] = "Illinois"
  geo[21] = "Michigan"
  geo[22] = "Wisconsin"
  geo[23] = "Kentucky"
  geo[24] = "Tennessee"
  geo[25] = "Alabama"
  geo[26] = "Mississippi"
  geo[27] = "Arkansas"
  geo[28] = "Louisiana"
  geo[29] = "Oklahoma"
  geo[30] = "Texas"
  geo[31] = "Minnesota"
  geo[32] = "Iowa"
  geo[33] = "Missouri"
  geo[34] = "North Dakota"
  geo[35] = "South Dakota"
  geo[36] = "Nebraska"
  geo[37] = "Kansas"
  geo[38] = "Montana"
  geo[39] = "Idaho"
  geo[40] = "Wyoming"
  geo[41] = "Colorado"
  geo[42] = "New Mexico"
  geo[43] = "Arizona"
  geo[44] = "Utah"
  geo[45] = "Nevada"
  geo[46] = "Washington"
  geo[47] = "Oregon"
  geo[48] = "California"
  geo[49] = "Alaska"
  geo[50] = "Hawaii"
  geo[51] = "District of Columbia"
  geo[52] = "Virgin Islands"
  geo[53] = "Puerto Rico"
  geo[54] = "New Mexico"
  geo[55] = "Guam, American Samoa, N. Mariana Isl., Philippines"
  geo[56] = "Puerto Rico"
  geo[57] = "Long-time or retired railroad workers"
  function stripZeros(inputStr) {
  var result = inputStr
  while (result.substring(0,1) == "0") {
  result = result.substring(1,result.length)
  }
  return result
  }
  function isEmpty(inputStr) {
  if (inputStr == "" || inputStr == null) {
  return true
  }
  return false
  }
  function isNumber(inputStr) {
  for (var i = 0; i < inputStr.length; i++) {
  var oneChar = inputStr.substring(i, i + 1)
  if (oneChar < "0" || oneChar > "9") {
  return false
     }
  }
  return true
  }
  function inRange(inputStr) {
  num = parseInt(inputStr)
  if (num < 1 || num > 586 && num < 596 || num > 599 && num < 700 || num > 728) {
  return false
  }
  return true
  }
  function isValid(inputStr) {
  if (isEmpty(inputStr)) {
  alert("Please enter a number into the field before clicking the button.")
  return false
  } else {
  if (!isNumber(inputStr)) {
  alert("Please make sure entries are numbers only.")
  return false
  } else {
  if (!inRange(inputStr)) {
  alert("Sorry, the number you entered is not part of our database.  Try another three-digit number.")
  return false
        }
     }
  }
  return true
  }
  function search(form) {
  var foundMatch = false
  var inputStr = stripZeros(form.entry.value)
  if (isValid(inputStr)) {
  inputValue = inputStr
  for (var i = 1; i <= ssn.length; i++) {
  if (inputValue <= ssn[i]) {
  foundMatch = true
  break
        }
     }
  }
  form.result.value = (foundMatch) ? geo[i] : ""
  form.entry.focus()
  form.entry.select()
  }
  // End -->
  </SCRIPT>
  
  <!-- STEP TWO: Paste this code into the BODY of your HTML document  -->
  
  <BODY>
  
  <FORM METHOD=post>
  Instructions:
  <OL><LI>Enter the first three digits of a U.S. Social 
  Security number in question.</LI>
  <LI>Click on the Search button.</LI>
  <LI>See the corresponding state or territory in the field.</L1>
  </OL>
  <CENTER>
  <P>Enter the first <B>three</B> digits of a Social Security number:
  <INPUT TYPE="text" NAME="entry" SIZE=3>
  <INPUT TYPE="button" VALUE="Search" ONCLICK="search(this.form)">
  <P>
  The Federal Government links this number to:  
  <INPUT TYPE="text" NAME="result" SIZE=50></center>
  <BR>
  <HR>
  <BR><BR><BR>
  <P><B>For the paranoiad:</B> No information you enter here is recorded or monitored - it stays entirely within your browser.
  </CENTER>
  </FORM>
  
  <p><center>
  <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
  by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  </center><p>
  
  <!-- Script Size:  4.95 KB  -->
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.