CS 142 Lecture Notes: JavascriptSlide 1 Simple Javascript Example sum = 0; for (i = 1; i < 10; i++) { sum += i*i; }

Slides:



Advertisements
Similar presentations
In our lesson today we will learn how to find the area of a building.
Advertisements

JavaScript (Part 2) CS 183 4/13/2010. JavaScript (Part 2) Will cover: ◦ For.. In ◦ Events ◦ Try.. Catch, Throw ◦ Objects.
Javascript Document Object Model. How to use JavaScript  JavaScript can be embedded into your html pages in a couple of ways  in elements in both and.
Programming Lecture #2 CS 101 Autumn 2007 Tariq Jadoon.
CS 142 Lecture Notes: RubySlide 1 Basic Ruby Syntax sum = 0 i = 1 while i
Презентація за розділом “Гумористичні твори”
Галактики і квазари.
CS 142 Lecture Notes: JavascriptSlide 1 Simple Javascript Example sum = 0; for (i = 1; i < 10; i++) { sum += i*i; }
AngularJS Controllers. A controller is a JavaScript object, created by a standard JavaScript object constructor. ng-controller directive defines an application.
1 CS101 Introduction to Computing Lecture 29 Functions & Variable Scope (Web Development Lecture 10)
1 CS101 Introduction to Computing Lecture 35 Mathematical Methods (Web Development Lecture 12)
1 CS101 Introduction to Computing Lecture 32 Event Handling (Web Development Lecture 11)
Web Programming and Security Lecture 1 Tamara Rezk.
Lab 5: drawing and output User Interface Lab: GUI Lab Sep. 25 th, 2013.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
CS 215 Web Oriented Programming Review Dr. Orland Hoeber orland
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Lab 3: Actionscript User Interface Lab: GUI Lab Sep. 11 th, 2012.
This is the series In other words it is Consider the bars and how the represent the numbers in the sequence, and how the total sum of all.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
Prototypal Inheritance. Can We Do Inheritance Without Classes? How do we share behaviour across objects.
Review Know all of the formulas of variations.
Web Programming Java Script & jQuery Web Programming.
Computer Engineering 2 nd Semester Dr. Rabie A. Ramadan 3.
“The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora
CS130 Visual Basic Project 4 Lecture Fall New topics in project 4 Database, file (table), records, fields. Application that contains menus, submenus,
CS 142 Lecture Notes: RubySlide 1 Basic Ruby Syntax sum = 0 i = 1 while i
Prototype Chain and Inheritance Prototype chain, Inheritance, Accessing Base Members Software University Technical Trainers SoftUni Team.
Simulating OOP in JavaScript Function Constructor, Prototypes, "this" Object, Classical and Prototypal Model Software University Technical.
OVERVIEW OF CLIENT-SIDE SCRIPTING
CS 142 Lecture Notes: JavascriptSlide 1 Simple Javascript Example sum = 0; for (i = 1; i < 10; i++) { sum += i*i; }
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Chapter 5 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
Squared and Cubed Conversion Factors
The Web Wizard’s Guide To JavaScript Chapter 4 Image Swapping.
Classes and Class Members
© 2016, Mike Murach & Associates, Inc.
Area of a Triangle.
Access Functions and Friend Functions
>> JavaScript: Location, Functions and Objects
Classes and Class Members
Simple Javascript Example
Intro to JavaScript CS 1150 Spring 2017.
Inheritance and Prototypes
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
Basic Ruby Syntax sum = 0 i = 1 while i <= 10 do sum += i*i
Basic Ruby Syntax sum = 0 i = 1 while i <= 10 do sum += i*i
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Substitution in string value
How to find the area of a parallelogram.
CS 140 Lecture Notes: Protection
CS 140 Lecture Notes: Protection
Implementing Non-Static Features
Simple Javascript Example
Extend Text Editor to Draw shapes
Today’s Objectives Week 12 Announcements ASP.NET
The Web Wizard’s Guide To JavaScript
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
Сътрудничество между полицията и другите специалисти в България
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
Simple Javascript Example
CS 140 Lecture Notes: Protection
HEADLINE GOES HERE. Directions to save header as JPEG:
Basic Ruby Syntax sum = 0 i = 1 while i <= 10 do sum += i*i
Presentation transcript:

CS 142 Lecture Notes: JavascriptSlide 1 Simple Javascript Example sum = 0; for (i = 1; i < 10; i++) { sum += i*i; }

CS 142 Lecture Notes: JavascriptSlide 2 Arrays x = new Array(); x[3] = 49; y = ["a“, 123, 65];

CS 142 Lecture Notes: JavascriptSlide 3 Objects x = new Object(); y = {name: "Alice", age: 23, state: "California"}; x.name = "Bob"; x["age"] = 21;

CS 142 Lecture Notes: JavascriptSlide 4 Factorial in Javascript function fac(x) { if (x <= 1) { return 1; } return x*fac(x-1); }

CS 142 Lecture Notes: JavascriptSlide 5 Method Example o = new Object(); o.count = 0; o.increment = function(inc) { if (inc == undefined) { inc = 1; } this.count += inc; return this.count; }

CS 142 Lecture Notes: JavascriptSlide 6 Functions Can Have Properties function plus1(value) { if (plus1.invocations == undefined) { plus1.invocations = 0; } plus1.invocations++; return value+1; }

CS 142 Lecture Notes: JavascriptSlide 7 Constructor function Rectangle(width, height) { this.width = width; this.height = height; } r = new Rectangle(26, 14);

CS 142 Lecture Notes: JavascriptSlide 8 Methods (wrong way) function Rectangle(width, height) { this.width = width; this.height = height; this.area = function() { return this.width*this.height; } r = new Rectangle(26, 14); a = r.area();

CS 142 Lecture Notes: JavascriptSlide 9 Prototypes function Rectangle(width, height) { this.width = width; this.height = height; } Rectangle.prototype.area = function() { return this.width*this.height; } r = new Rectangle(26, 14); a = r.area();

CS 142 Lecture Notes: JavascriptSlide 10 Embedding Javascript... //<![CDATA[ alert("Page is loading"); //]]> Click here.... External Javascript File Inline Code Event Handler

CS 142 Lecture Notes: CookiesSlide 11