Archive for April, 2008

The Scope of Variables

Wednesday, April 30th, 2008

The scope of a variable is the extent of the code in which the variable exists. For JavaScript variables defined within a function their scope is the function that they are defined in. Variables defined outside of functions as well as variables used without being first defined have global scope.

The Scope of Variables

Optional Parameters

Tuesday, April 29th, 2008

With JavaScript functions we don’t need to have a specific number of parameters to pass into a function. If we have situations where fewer parameters are required then we can set the JavaScript up to handle that simply by placing the mandatory ones first in the list and following them with the optional ones. JavaScript can go one better than that though since it provides a way handling the situation where you havw an unknown number of optional parameters. Whether you have no parameters at all or as many as someone takes the time to enter, JavaScript can handle it.

Optional Parameters

Same Function Different Variables

Monday, April 28th, 2008

Continuing on the introductory JavaScript series about functions this third tutorial looks at how we can define arguments within the function so that we can pass different parameters to the function each time we call it rather than having the function access our global variables and hence always process the same variables.

Same Function Different Variables

Passing Information Between Pages

Sunday, April 27th, 2008

There are three ways that you can pass data between web pages using JavaScript and this article shows you how each of the three methods works.

  • using a cookie
  • using frames
  • or on the end of the URL as a querystring

There are of course other ways to pass information between pages using server side processing such as posting the data between pages or using a session but these require server side processing that some web sites may not available. Noe that you can POST data using JavaScript but you need server side processing in order to read it back.

Passing Information Between Pages

ISP System Glitch - I Hope

Saturday, April 26th, 2008

Yesterday my ISP blocked my internet access for a couple of hours when their automated spam blocker somehow misidentified my connection as having been sending spam. The ISP did not of course accuse me of sending spam, their block page suggested that it would have actually been caused by a virus or spyware having got installed on my system and that this was the most likely source of the spam. Their block page also offered free antivirus and antispyware software for download so that you could use the time you were blocked in scanning your system to find and remove the problem.

I didn’t need their download links because I already have a full range of security software installed on all my computers and the antivirus software had already brought itself completely up to date before the block started.

(more…)

Hot Spot Image Rollovers

Friday, April 25th, 2008

Here’s a way to save a lot of space on a web page by placing all of your images in the same spot on the page and using JavaScript to determine which of the images is the one that is currently visible.

Hot Spot Image Rollovers

Using Custom Bullets for Your Unordered Lists

Thursday, April 24th, 2008

The basic difference between ordered and unordered lists is that ordered lists use a different “bullet” on the front of each entry with values that have some sort of ordering to them (such as A, B, C, D or I, II, III, IV) while unordered lists display the same bullet on the front of each entry. This indicates that the entries in the list are all equivalent and that there is nothing special about the order in which the entries appear.

There are a number of different bullets that are supplied to be used for this so that different lists that may be listed inside one another can be distinguished. These include squares, triangles, and circles in both outline and filled versions. One thing about CSS though is that it makes it extremely easy to substitute your own custom bulletssimply by creating your bullet as an appropriately sized image.

In one of my earliest stylesheet articles I wrote about how to do this using a small image of a computer as the bullet.

Using Custom Bullets for Your Unordered Lists

c

Wednesday, April 23rd, 2008

If you allow your CD-ROM/DVD drive to take whatever drive letter your system assigns to it then any changes you make to your system such as adding an extra hard drive will result in the drive letters for your removable media drives changing. This will break any links to that media that you have saved as shortcuts on your computer. In order to avoid this happening you can easily change the drive letter to something further along the alphabet using a letter that makes sense to you and freeing up the earlier letters for the system to reallocate as needed.

In this article I show how to change the drive letter allocation in the now obsolete Windows 95/98/SE/ME range of operating systems. More modern windows operating systems also provide an option to do this but it is accessed a different way. I suppose I really ought to write a new version of this page for the operating systems that people are using now.

Assigning a Different Drive Letter to the CD ROM Drive