GoldBorder Title GoldBorder Title
Programming: Lesson 7, One Your Own
"These lessons are fine, but, how do YOU create code on your own outside of these lessons page without the 'magic' box you have been typing code into?"
Note: I am assuming you are doing this on a computer with Microsoft Windows.

The way your computer knows if a file is a graphic, web page, program, etc.. is by the 'file extension' a filename has.

File Names on a computer have two parts. The 'Name' and the 'Extension'. For example, here is a File Name:

    myWebPage.htm

The computer knows which part is the 'Name and which part is the 'Extension' by where the last period is in the name. Going by this, the name above is split by the computer like:

    myWebPage.htm

When you ask the computer to open a file by double-clicking on it, choosing 'Open', etc.., it splits the File Name into the 'Name' and 'Extension'. Then, uses the 'Extension' to figure out what program is used to open it. For example, the following extensions could cause the following programs to be used:

  • .htm: Open using an Internet Browser
  • .jpg: Open using a Graphic Program (Internet Browsers can open/show graphics as well)
  • .doc: Open using Microsoft Word

Unfortunately, Microsoft decided to 'hide' File extensions. You can turn viewing these 'back on' by telling Microsoft Windows to do so. A quick search on Google for "microsoft show file extensions" will show you how to do this.

Knowing you can control which program your computer uses for a file, you can create a 'Web Page' on your computer, put some JavaScript code into it and you will have all the tools you need to develop programs. Remember, Web Pages, Programs, Emails, Essays are all created in the same way....YOU typing what you want and saving it to your computer.

At this point, you should be asking "How do I create a File on my computer with a File Extension of .htm?"

Let's tell the computer we want it to pop-up a message to the viewer. You can enter the code:

    alert("Hello Viewer");
into the box below.

Now, click on this button to see if you code worked. Since this will cause your Browser to parse the code you enter.

Feel confident? Go back into the box and change "Hello Viewer" to another message and re-click the 'Check My Code' button.

See, you were able to write code for FREE and the viewer (you again) was able to run the code for FREE.