Intranet Journal   Earthweb  
Events Jobs Premium Services Media Kit Network Map E-mail Offers Vendor Solutions Webcasts

   Intranet Journal Subjects
Search Earthweb

Privacy Policy



internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

internet commerce
Be a Commerce Partner
















 

[ Home | Discussion Forum | How Do I... | Lotus Notes Intranets | Microsoft SharePoint | Products | Shopping  ]

free news!


Intranet Journal Intranet FAQ

IDM Intranet FAQ          [Previous | Index | Next]

JavaScript FAQ

Answers to Questions about...
the First Principles of JavaScript/JScript

1. What are the language's basic entities?

A. As in most object-oriented, event-driven programming languages, there are four distinct entities in JavaScript:

  • OBJECTS. A discussion of objects is beyond the scope of this FAQ (see the section "Objects and the Web" in Intranet Journal's Intranet FAQ for background). It's impossible to understand JavaScript without knowing the following essentials, however:
    1. everything you can control in a web browser is an object comprising properties and methods (sometimes referred to in the literature as attributes and operations, respectively)
    2. properties define the state of an object; e.g., red text, 10-element array
    3. methods define the actions that change the state of an object; e.g., fontcolor("red") sets the color of a text object to red.

  • FUNCTIONS. Methods that operate outside of objects; e.g., escape() and unescape(), JavaScript functions that perform ASCII to hex conversions. The existence of non-object-specific functions in JavaScript keeps it from being a truly object-oriented language like Java.

  • STATEMENTS. Programming commands that control object lifecycles and the flow of execution; e.g., if..else, while. JavaScript statements and syntax closely resemble those of the 'C' programming language.

  • EVENTS. Things that happen, usually as a result of user actions, to which a JavaScript program can respond; e.g., a mouse click. Events always happen in relation to a given object, such as a button in a form (for which onClick is a typical event), or an entire web page (sample event: onLoad). The code that specifies what the object should do in response to an event is a special type of method called an event handler.

IDM Intranet FAQ          [Previous | Index | Next]

[print version of this page]