Objects, Properties, Methods - Introduction to Computing - Lecture Slides, Slides of Introduction to Computing

Objects, Properties, Methods, Client Side Scripts, Advantages of Client Side Scripting, Disadvantages, JavaScript, Client Side JavaScript, Case Sensitivity, JavaScript is Object Based and some other key points are also part of this lecture.

Typology: Slides

2011/2012

Uploaded on 11/03/2012

banamala
banamala 🇮🇳

4.4

(19)

114 documents

1 / 51

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS101 Introduction to Computing
Lecture 18
Objects, Properties, Methods
(Web Development Lecture 6)
1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33

Partial preview of the text

Download Objects, Properties, Methods - Introduction to Computing - Lecture Slides and more Slides Introduction to Computing in PDF only on Docsity!

CS101 Introduction to Computing

Lecture 18

Objects, Properties, Methods

(Web Development Lecture 6)

During the last lecture we continued our

discussion on Interactive Forms

  • We got our first taste of JavaScript – the object- based language that we will be employing throughout the rest of the Web development part of this course
  • We developed a (simple) client-side script in JavaScript

Last time we looked at two distinct ways of performing the “form” field checking function.

From now onwards, we will be employing the 2nd^ way more often than not

In that 2 nd^ way, we referred to a function in the HTML BODY, and but defined that function in the HTML HEAD

Send an eMail }

Send an eMail From: To: Subject: Message:

New Concept: Client-Side Scripts

  • Small programs that are a part of the Web page and run on the user’s (client’s) computer
  • They interact with the user to collect info or to accomplish other tasks
  • Once it has been collected, they may help pass the collected info on to a server-side script
  • We’ll use JavaScript to do client-side scripting. However, there are many other languages that can be used for that purpose, e.g. VBScript (^8)

Disadvantages

  • Client-side scripts do not work with all browsers
  • Some user intentionally turn scripting off on their browsers
  • This increases the complexity of the Web page, as it now has to support both situations: browsers with scripting capability, and those not having that capability

JavaScript

  • A programming language specifically designed to work with Web browsers
  • It is designed to be used for developing small programs – called scripts – that can be embedded in HTML Web pages
  • JavaScript:
    • Is an interpreted language
    • Supports event-driven programming
    • Is object-based

Some of the things that JavaScript can do!

  1. Control the appearance of the browser
  2. Control the content and appearance of the document displayed in the browser
  3. Interact with the user through event handlers
  4. Arbitrary calculations, including floating-point ones
  5. Store & modify a limited amount of data about the user in the form of client-side “cookies” (^13)

Client-Side JavaScript

Although a version of JavaScript exists that can be used to write server-side scripts, our focus in this course will only be on client-side scripting

JavaScript

  • A programming language specifically designed to work with Web browsers
  • It is designed to be used for developing small programs – called scripts – that can be embedded in HTML Web pages
  • JavaScript:
    • Is an interpreted language
    • Supports event-driven programming
    • Is object-based

JavaScript is Object-Based

  • Everything that JavaScript manipulates, it treats as an object – e.g. a window or a button
  • An object has properties – e.g. a window has size, position, status, etc.
  • Objects are modified with methods that are associated with that object e.g. a resize a window with resizeTo(150, 200)

Object: A named collection of properties (data, state) & methods (instructions, behavior)

19

prop 1 prop 2

prop 5

name prop 3

prop 4

A collection of properties & methods

All objects have the “name” property: it holds the name of the object (collection)

method 1^ method 3

method 2

Example: A Bicycle

20

color

height

direction

name pressure

inflate() speed turn()

accelerate()

park()