Parameters that are Part of theAddress

The window.location.search variable contains the part of the page address following the ?.   An '&' is used to separate parameters.

The first function parses a "keyword=value" from the page address. 

The second function is for debugging date based pages.  It uses the first function to set the date.  If the today= keyword isn't found, the current date is used.  if the date supplied, that value is used for the date.

The final snippet, shows how the date function can be used.

  <title>Test parameters</title>
  <script language="JavaScript">
  //Example location: http://www.yourpage.com/page.html?key1=value1&key2=value2

  //Purpose: Parse the string after the '?' in the page location
  //Usage:   value = GetParam(keyword)
  //value:   The value after the "keyword=" and before the next '&' or end of line
  //         If the keyword isn't found, "" is returned.
  //keyword: The keyword to search for including the trailing '='
  function GetParam(param) {
    var searchStr = window.location.search;
    var start = searchStr.indexOf(param);
    if (start == -1) {
      return "";
    } else {
      var keyLen = param.length;
      var theEnd = searchStr.indexOf("&", start+keyLen);
      if (theEnd == -1) theEnd = searchStr.length;
      return (searchStr.substring(start+keyLen, theEnd));
    }//if
  }//GetParam

  //Purpose: Return today's date or a value passed with the page location
  //Usage:   value = Today()
  //value:   A date object for today or date passed in
  //Example: ?today=01/31/2003
  function Today() {
    dateStr = GetParam("today=");
    if (dateStr.length == 0) {
      var today = new Date();
    } else {
      var today = new Date(dateStr);
    }//if
    return(today);
  }//Today



 <script language="JavaScript">
 <!--

   var dateObj = Today();

   with (document) {
     var spring = new Date("11/16/2003");
     if (dateObj < spring) {
       write("
<p><b>2003 Fall Conference</b> - ");
       write("
<a href=FallConf.shtml>Hear the President of Toastmasters ");
       write("
International, educational sessions &amp; climax of ");
       write("
contests</a></p>\n");
     } else {
       write("
<p><b>2004 Spring Conference</b> - ");
       write("
<a href=district_7_spring_conference_regis.pdf>Educational");
       write("
sessions &amp; climax of contests</a></p>\n");
     }//if
   }//with

 //-->
 </script>