Another object that we may have occasion to use is the location object. The location object is a property of the window object...
And, like other objects, the location object has properties. One commonly used property is the href property...
This specifies the URL of the document in that particular window.
Look at this script...
The function ShowUrl() gets the location and displays it in an alert box. The function GoUrl() sets the window's location to something else thereby causing that other page to load in the window.
Exercise: Make 6 separate little web pages for each of the Brady kids. Something like this is fine. Alter the last exercise and instead of an alert box throwing up the value "bobby", change the value to the url of bobby's page (bobby.html, or whatever you name it.) Then, get that value and set that as the window's new href. The result is a nifty jump box.
Here is a solution.
We can define our own arrays. Let's suppose we want to define an array of colors...
First we would declare a new array...
colors = new Array();
Then define the individual elements of the array...
colors = new Array(); colors = "red"; colors = "blue"; colors = "green"; colors = "yellow"; colors = "purple"; colors = "orange";
Again, note the zero-based counting scheme. The colors array above has 6 elements, and we can reference each by number. Consider the following...
While it's certainly not the most useful script in the world, it does demonstrate a new Array() quite nicely. Understand what's going on here before you continue.
|Lessons: Intro 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25|
|HTML 4.0 Reference Google Groups (Advanced Search)|