1 / 11

OPERATOR - JavaScript

OPERATOR - JavaScript. Lesson 2. Working with Objects, Properties and Methods. Objects

yasuo
Download Presentation

OPERATOR - JavaScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OPERATOR - JavaScript Lesson 2

  2. Working with Objects, Properties and Methods • Objects • JavaScript is an object-oriented programming language, and as such, treats all elements in your HTML document as objects. Each object has a container called window, and inside a window are smaller objects, such as the following:

  3. Methods • Methods are special programming commands associated with object. • Always remember that objects have their own set of methods. • The syntax for writing the object-method function is as follows: object.method() • Each object has its own set of methods. • Methods are also called statements. • A JavaScript code may contain as many methods as necessary.

  4. Properties • Properties are values associated with objects and hold the attributes of objects with the script. • The syntax for assigning property o an object is similar to the syntax for writing methods. • For example, writing document.bgcolor • Document.title

  5. String Objects • A string object can be any text enclosed in quotations. • Example • var txt=“String Object!”; • document.write(txt.length);

  6. Functions and Events • Functions are essential methods that perform operations independent of objects. • Functions are not necessarily associated with objects but provide commands that manipulate objects.

  7. Events • Events occur when visitors interact with certain elements in a Web page. • Are actions taken by your visitors, such as slicking a button, loading a page, or submitting information through an online form. • This interaction sets off a series of events and these events usually occur as functions.

  8. Commonly used JavaScript events

  9. Event Handlers • After you have set up your functions, you can assign them to events in your script. • You need to assign them to event handlers.

More Related