Goodies To Go! Newsletter #341

By Vince Barnes



Goodies to Go (tm)
June 13, 2005 -- Newsletter # 34
This newsletter is part of the internet.com network.


Featured this week:
*   Goodies Thoughts - The CGI Language?
*   Q & A Goodies
*   News Goodies
*   Feedback Goodies
*   Windows Tech Goodie of the Week 
*   And Remember This...

The CGI Language?

We hear the reference to CGI scripts quite commonly.  Perhaps it is this that has led to a common misunderstanding about CGI.  When we talk about VB scripts, we are talking about scripts written in the Visual Basic language.  Perl scripts are written in the Perl language.  It's understandable, therefore, that some folk would believe CGI scripts to be written in the CGI language.  It's not so though, I'm afraid.
CGI stands for the Common Gateway Interface.  Basically, while a web server's job is to serve up web pages, there is a need to be able to get at and serve up information that is not held in web pages.  This information might be stored, for example, in a database or perhaps in a series of text files.
The CGI is a specification for how to implement an interface, or link, between the web server and an application that has access to that information.  It is, essentially, an agreement among web server implementers on how to set up such an interface.  If you'd like to really get into it, you can find all the technical details at http://www.w3.org/CGI/
Common uses for the CGI are to enable programs written in languages like PERL or UNIX Shell Scripts to incorporate dynamic information into otherwise static web pages.  The language involved is the language of the application itself, not the CGI.  The CGI is not a language.
In the HTML Goodies site there a several examples of using the interface to connect to applications, including a guestbook, a poll and a bulletin board.  You can find them at http://www.htmlgoodies.com/beyond/cgi  In these examples, which were mostly written by Joe Burns you will often see references to "a CGI".  This is common parlance, but it is misleading.  It is not so much "a CGI" as "an application using the CGI". It's just that "a CGI" is so much quicker and easier to say!
I hope that clears it up for you!

Thanks for Reading!

- Vince Barnes
Q & A Goodies
Questions are taken from submissions to our Community
Mentors. You can ask a Mentor a question by going to

Q.  I'm making a form that will be used by users to apply for a job. I want to make sure that the form will not be submitted if they type text into the "phone number" text box. All my attempts have failed, Could you give me an idea of what is going on?
var x = 0
function checkdata() {
  if ( (document.job.dobday.value.indexOf("a") == -1) ||
       (document.job.dobday.value.indexOf("b") == -1) ||
       (document.job.dobday.value.indexOf("c") == -1) ||
       (document.job.dobday.value.indexOf("d") == -1) ||
       (document.job.dobday.value.indexOf("e") == -1) ||
       (document.job.dobday.value.indexOf("f") == -1) ||
       (document.job.dobday.value.indexOf("g") == -1) ||
       (document.job.dobday.value.indexOf("h") == -1) ||
       (document.job.dobday.value.indexOf("i") == -1) ||
       (document.job.dobday.value.indexOf("j") == -1) ||
       (document.job.dobday.value.indexOf("k") == -1) ||
       (document.job.dobday.value.indexOf("l") == -1) ||
       (document.job.dobday.value.indexOf("m") == -1) ||
       (document.job.dobday.value.indexOf("n") == -1) ||
       (document.job.dobday.value.indexOf("o") == -1) ||
       (document.job.dobday.value.indexOf("p") == -1) ||
       (document.job.dobday.value.indexOf("q") == -1) ||
       (document.job.dobday.value.indexOf("r") == -1) ||
       (document.job.dobday.value.indexOf("s") == -1) ||
       (document.job.dobday.value.indexOf("t") == -1) ||
       (document.job.dobday.value.indexOf("u") == -1) ||
       (document.job.dobday.value.indexOf("v") == -1) ||
       (document.job.dobday.value.indexOf("w") == -1) ||
       (document.job.dobday.value.indexOf("x") == -1) ||
       (document.job.dobday.value.indexOf("y") == -1) ||
       (document.job.dobday.value.indexOf("z") == -1) ||
       (document.job.dobday.value.indexOf("!") == -1) ||
       (document.job.dobday.value.indexOf("#") == -1) ||
       (document.job.dobday.value.indexOf("$") == -1) ||
       (document.job.dobday.value.indexOf("%") == -1) ||
       (document.job.dobday.value.indexOf("^") == -1) ||
       (document.job.dobday.value.indexOf("&") == -1) ||
       (document.job.dobday.value.indexOf("*") == -1) ||
       (document.job.dobday.value.indexOf("(") == -1) ||
       (document.job.dobday.value.indexOf(")") == -1) ||
       (document.job.dobday.value.indexOf("-") == -1) ||
       (document.job.dobday.value.indexOf("_") == -1) ||
       (document.job.dobday.value.indexOf("+") == -1) ||
       (document.job.dobday.value.indexOf("=") == -1) ||
       (document.job.dobday.value.indexOf("{") == -1) ||
       (document.job.dobday.value.indexOf("}") == -1) ||
       (document.job.dobday.value.indexOf("[") == -1) ||
       (document.job.dobday.value.indexOf("]") == -1) ||
       (document.job.dobday.value.indexOf("@") == -1) ||
       (document.job.dobday.value.indexOf("~") == -1) ||
       (document.job.dobday.value.indexOf("<") == -1) ||
       (document.job.dobday.value.indexOf(">") == -1) ||
       (document.job.dobday.value.indexOf("?") == -1) ||
       (document.job.dobday.value.indexOf(".") == -1) ||
       (document.job.dobday.value.indexOf("/") == -1) ||
       (document.job.dobday.value.indexOf("|") == -1)){x = 1}
if (x = 1){
alert("no letters are allowed in the phone text box");
return false;}
A.(1) Take a look at the HTMLGoodies Javascript Primer #29 - Putting It All Together: Form Field Validation located at
The example includes the validation of a numeric zip code that should be easy enough to adapt to a phone number. It will also shorten your script considerably.
A.(2) You could also use the method isNaN (is-Not-a-Number) to insure that only numbers are entered.  It goes something like this:
  {alert("Numbers only please!")}
Q. I have recently made an e-mail form with the help of the tutorial on the site, and my form is made up entirely of text boxes. However, I find that the
text boxes are ugly.. I would like the borders of them to be a different colour, so they do not have that "greay shadow" look. I know it is possible to change the colour of them, as I have seen it done on another website, but how can I do it on mine?
A. The easiest way to do it is to set up a style for the "input" in you style sheet, since you are only using text boxes. The following will also apply to any radio buttons or checkboxes that may be in the form. If you add them later, you may want to set up a class. But for now, add this to your style
input { border: 1px solid black; }
You can use change the pixel size, or switch from solid to dashed. For colors, you can use the text names that are available, or the hexidecimal (#000000).
Q. I have been asked to apply colors to the background and text of the web page whenever an item in various list boxes has been changed. The list boxes contain various background and text color choices, which have been assigned variables within the apply_color() function that I just created. Got any tips?
A. Here is a example of how you can set up various style classes with the text color and background color and then through the dropdown assign one of those classes to the body of the document.  This will change the color for all text in the body of the document along with the background color.  This will not work in older browsers such as Netscape 4 versions:
  .tcolor {color:white;background-color:black}
  .bcolor {color:black;background-color:white}
  .jcolor {color:red;background-color:yellow}
  .fcolor {color:blue;background-color:lightgreen}
<script type="text/javascript">
function doIt(selclass)
<body class="tcolor">
This is some text that hopefully the color will change along with the background color <form> <select onChange="doIt(this.options[this.selectedIndex].value)">
  <option value="bcolor">Black/White</option>
  <option value="jcolor">Red/Yellow</option>
  <option value="fcolor">Blue/Lightgreen</option>
  <option value="tcolor">White/Black</option>
Q. What is the simplest way to create a 'bookmark button' to book mark (or add to favorites) a certain page?  I might mention that the page I want to put it on is forwarded and masked, don't know if that makes any difference.
A.  To place a bookmark link on a page you need to do the following. I will use a link to take a person to the top of the page as an example.  Near the top of the page, usually directly after the <BODY> tag you would enter the following:
<a name="top"></a>
At the bottom of the page or any place you want the link you would create the following link:
<a href="#top">TOP^</a>
When the link is clicked on you "jump" to the top of the page. If you want to use a "bookmark" from one page to another you would create the link like this:
You can of course create as many as you need and name them differently for diferent areas on the page. When you are masking you will have to use the actual URL and not the shortened URL. For instance your actual URL might be http://www.geocities.com/my_folder_name/my_page_name.htm
and you are pointing a shorter URL to it named
http://www.my-site.com. You have to use the longer URL in the hyperlink.

News Goodies
Proxim Sells Out
[June 13, 2005] The struggling Wi-Fi equipment provider has filed for bankruptcy and will become a subsidiary of another tech company to get out from under debt.
Read the article:

IBM Delivers Baby Brother For Blue Gene
[June 13, 2005] Big Blue introduces a new supercomputer to complement its high-flying Blue Gene/L machine in the research field.
Read the article:

Microsoft Puts Aruba Networks on The Map
[June 13, 2005] UPDATED: Microsoft gives the small network equipment maker the corporate WLAN contract once owned by Cisco.
Read the article:

VoIP Providers Assemble e911 Pieces
[June 13, 2005] Broadband telephony companies are taking different routes to comply with the FCC's order.
Read the article:

VA, Black Duck Team on Open Source Projects

[June 13, 2005] Integrated toolkit is designed to manage software licenses throughout a company's development lifecycle.
Read the article:

Red Hat Releases Fedora Core 4
[June 13, 2005] The new version promises a cleaner desktop experience and PowerPC port, to boot.
Read the article:

Is Grove Behind Apple Chip Switch?
[June 10, 2005] Did Intel's former CEO Andy Grove lay the groundwork for the Apple-Intel deal?
Read the article:

Microsoft Betas 'Acrylic'
[June 10, 2005] Acrylic beta designed for organic-looking pixels and vectors.
Read the article:

Trojan Spreads in Michael Jackson Spotlight
[June 10, 2005] It's hiding in an e-mail claiming the singer attempted suicide.
Read the article:

Hackers Monkey With Korean Mozilla Site
[June 10, 2005] The breach brings calls from some in the open source community to gain control of the independent site.
Read the article:

Feedback Goodies
Thanks for all your feedback!

Windows Tech Goodie of the Week 
Reading and Writing XML in .NET Version 2.0 - Part 1
In the first part of his series on reading and writing XML in .NET 2.0, Alex Homer discusses the XmlReader and XmlReaderSettings classes. The XmlReader exposes several useful new features and the all new XmlReaderSettings class makes it easy to generate single or multiple instances of an XmlReader with a range of useful properties.

*** AND ***

Effective Data Paging Using SQL Server 2005 and Microsoft's Enterprise Library
Using the DataGrid's built in paging mechanism is a convenient and easy way to implement paging, but as your database grows you may notice a considerable delay while paging. The problem is that the DataGrid doesn't just get the records for the current page... it actually retrieves them all! This acticle shows you a more efficient way to handle paging using some of the new features in SQL Server 2005 and Microsoft's Enterprise Library.

*** AND ***

Enter and the Button Click Event
Of particular interest to ASP.NET developers is that when creating an ASP.NET Web Form, hitting Enter to submit the form seemingly sometimes causes the page's Button Web control's Click event to fire, and other times not. In this short article we'll see under what conditions a Button Web control's Click event might not fire when the user submits the page hitting Enter; furthermore, we'll look at a workaround. Read on to learn more!

And Remember This ...
On this day in...
323BC Alexander the Great died of a fever at Babylon; 1886 fire destroyed nearly a thousand buildings in Vancouver BC; 1888 The US Congress created the Department of Labor; 1930 22 people were killed by hailstones in Siatista Greece; 1966 the US Supreme Court handed down its Miranda decision, stating that suspects must be read their rights; 1967 Thurgood Marshall was nominated as the first black US Supreme Court Judge; 1980 the UN security council called for S. Africa to release Nelson Mandela; 1983 Pioneer 10 became the first man made object to leave the solar system; 1981 a teenager fired 6 blanks at Queen Elizabeth II; 1990 Washington DC Mayor Marion Barry announced he would not seek a fourth term;
Born today were: in 1865 Irish poet William Butler Yeats; 1892 S. African actor Basil Rathbone; 1935 Bulgaran wrap artist Christo; 1941 actor Tom Hallick; 1941 actor Robert Forester; 1951 actor Richard Thomas; 1962 actress Ally Sheedy; 1986 actress twins Mary Kate and Ashley Olsen

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.