Your Guide to Professional
Web Site Design and Development

HTML Tips
HTML Codes
Web Development
Web Design Tips
JavaScript Codes
216 Web Safe Colors
CSS Tutorial
JavaScript Tutorial
ASCII Character Codes

 

| Web Site Development | HTML Codes | HTML Tips | Web Design TipsJavascript Snippets | 216 Safe Colors | Symbols | CSS Tutorial | JavaScript Tutorial |

JavaScript Tutorial: The JavaScript Food Chain


When dealing with JavaScript objects, there is a food chain. JavaScript works from the outside in. So, the food chain would be as follows:

window document objects in the document

If we were talking about images, the chain would be:

window document images

If we were talking about forms, the chain would be:

window document form fields and submit button

However, in JavaScript, we denote this food chain using dots, such as:

window.document.objects
window.document.images
window.document.form.fields

As you can see, there is a certain order to things, and JavaScript doesn't accept anything less. This is true for Arrays as well. JavaScript demands that the first item in the Array is 0, and that the Array items are listed in order.

Your web browser also uses an Array system. It sees the first image on your web page and assigns it an Array number of zero, the second object is assigned 1, and the third is assigned 2, and so on. In fact, it assigns Array's for graphics, links, anchors, and forms as well as the page loads.

It is important to understand the JavaScript food chain, and to think just as JavaScript and your browser thinks as you write code - from the outside to the inside.

Previous

Next



  JavaScript Tutorial: An Introduction to JavaScript
  The Basics of JavaScript
  JavaScript Events
  JavaScript Variables and Arrays
  JavaScript Statements
  JavaScript Functions and Methods
  JavaScript Errors
  JavaScript Food Chain
  Writing JavaScript Code
  JavaScript Object Reference
  JavaScript Events Reference
  JavaScript Functions Reference
  JavaScript Math Object Reference
  JavaScript Array Object Reference
  JavaScript String Object Reference
  JavaScript Date Object Reference

Web Development Tutorials

  Cascading Style Sheets Tutorial: An Introduction to Cascading Style Sheets
  JavaScript Tutorial: An Introduction to JavaScript
  Web Development: A step by step guide to developing a successful Internet business
  HTML Codes Chart: Copy and paste HTML codes for your web page
  HTML Tips: Copy and paste special effect HTML codes for your web page
  Web Design Tips: Tips, tricks, and special effect codes for your web page
  JavaScript Code Snippets: Copy and paste special effect JavaScript codes for your web page
  216 Web Safe Color Chart: Hexadecimal and RGB Color Codes for your web page
  ASCII Character Codes Chart: American Standard Code for Information Interchange character codes chart