SEEM4570 System Design and Implementation Lecture 03 JavaScript

Size: px
Start display at page:

Download "SEEM4570 System Design and Implementation Lecture 03 JavaScript"

Transcription

1 SEEM4570 System Design and Implementation Lecture 03 JavaScript JavaScript (JS)! Developed by Netscape! A cross platform script language! Mainly used in web environment! Run programs on browsers (HTML is not programmable)! It can be run on the server side also! Node.js is an example! Supposed to call "mocha" or "LiveScript", but changed to "JavaScript" eventually! Netscape wants to continue the success of Java!

2 JavaScript (JS) (cont'd)! Some typical usages:! Form validation! Handle Events (e.g., when you "click" a button, when you mouse move, etc.)! Animations and visual effects! Manipulate Cookies! A cookie is a small piece of data stored in your computer by the browser when you browse a web page.! Interact with different HTML components! JavaScript (JS) (cont'd)! JavaScript is a Scripting Language! A scripting language is a lightweight programming language.! It does nothing with Java.! Easy to learn.! JavaScript is an Object Oriented Programming Language (as least from my point of view)! Some people may argue with me But that's fine, different people have different opinions, right?! A good article:!

3 Different Kinds of Programming! In general, there are two kinds of programming:! Procedural Programming! Also known as Imperative Programming! E.g., C! Object Oriented Programming (OOP)! E.g., Java, C++, Objective-C! We will discuss OOP in detail later!! In order to appreciate the powerfulness of OOP, it is better to learn how to write! The <script> Tag! JavaScripts must be written in <script> </script>.! <script> </script> can be put anywhere in <html> </html>.! Try this:! <script> alert("my First JavaScript"); </script> Old examples may write <script type="text/javascript"> instead of <script>. This is no longer required NOW because JavaScript is THE DEFAULT scripting language in ALL modern browsers now.

4 Writing JS Statement and Semicolon! Each JS statement is a command to the browser. The purpose of the statements is to tell the browser what to do.! Just like any programming language! You can add semicolon (" ; ") or not to add a semicolon at the end of a JS statement! Ending statements with semicolon is optional in JavaScript.! But I recommend you to add semicolon.! Your code will be more clean and easy to follow Writing JS Comments! Similar to C or Java, we use /**/ or // to write comment:! <script> /* This is a comment */ alert("hello"); // This is another comment alert("yeah"); </script>

5 Writing JS Variables! Like all programming languages, JS also have variables to store data! Unlike C or Java, you do not need to define the data type!! A sample C program:! main(){ int a = 10, b = 12; double pi = ; char[5] str = "hello";! A sample JS program:! var a = 10, b = 12; var pi = ; var str = "hello"; Writing JS Variables (cont'd)! For a programming language that do not need to define the data types of the variables, we call these programming has a feature of Dynamic Typing.! Data types of variables will be defined dynamically! E.g. PHP, JS,! Otherwise, if we need to define the data types, we call them Static Typing! E.g. C, C++, Java,

6 Writing JS Variables (cont'd)! By default, a variable has the value "undefined" if you have not assign anything value to it! Example:! var a = 10; // it has the value 10 var b; // it has the value "undefined"! If you re-define a variable, the previously defined value may not necessarily be overwritten.! Example:! var a = 10, b = 20; var a; var c = a + b; // the result is 30 Writing JS Variables (cont'd)! There are totally 7 different data types:! Boolean! Number! String! Undefined! Null! Array! Object

7 Data Types Booleans! A Boolean is a logical entity that consists of either a true or a false value:! var x = true;! var y = false; Data Types Number! You do arithmetic same as any programming languages! var a = 10; var b = 20; var pi = ; var r = a + b; var area = pi * r * r; :! Extra large or extra small numbers can be written with scientific (exponential) notation! var y=123e5; // ! var z=123e-5; //

8 Data Types String! A string can be any text inside quotes. You can use single or double quotes:! var s1 = "Hello", s2 = 'Hello'; // both are CORRECT!! String manipulation in JS is the same as Java:! var s1 = "How"; var s2 = "are"; var s3 = "you?"; var com1 = s1 + s2 + s3; // Output: Howareyou? var com2 = s1 + " " + s2 + " " + s3; // Output: How are you?! You can combine different types of variables as well:! var a = 10, b = 20; var c = a + b; var text = "The result is : "; var final = text + c; // Output: The result is: 30 Data Types Null and Undefined! Variables can be emptied by setting the value to null! var str; // it is undefined. NOT null!!! var str = "hello"; str = null; // set to empty str = 10; // set the value to 10 str = null; // empty it again

9 Data Types Arrays (1)! You can define it in many ways.! They are equivalent:! var courses = new Array("SEEM4570", "SEEM3490");! var courses = ["SEEM4570", "SEEM3490"];! var courses = new Array(); courses[0] = "SEEM4570"; courses[1] = "SEEM3490";! var courses = []; courses[0] = "SEEM4570"; courses[1] = "SEEM3490"; Data Types Arrays (2)! You can even have your own "key":! They are equivalent:! var courses = []; courses['one'] = "SEEM4570"; courses['two'] = "SEEM3490";! var courses = []; courses.one = "SEEM4570"; courses.two = "SEEM3490";! Note: you should NOT use any number to begin the Key! courses.1 = "SEEM4570" // WRONG! courses.1s = "SEEM4570" // WRONG! courses.s1 = "SEEM4570" // CORRECT

10 Data Types Objects! Well, this is a bit difficult to understand right now. Let's come back later. Typeof Operator! A less-known operator in JavaScript is the typeof operator. It tells you what type of data you're dealing with:! var booleanvalue = true;! var numericalvalue = 354;! var stringvalue = "This is a String";! var nullvalue = null;! var undefined;! alert(typeof booleanvalue) // displays "boolean"! alert(typeof numericalvalue) // displays "number"! alert(typeof stringvalue) // displays "string"! :

11 JavaScript as Function! We can write function using JS:! <!DOCTYPE html> <html> <script> function myfunction(){ document.write("<p>this is a paragraph 1</p>"); document.write("<p>this is a paragraph 2</p>"); </script> <body> <script>myfunction()</script> </body> </html> JavaScript as Function (cont'd)! Obviously, we can pass values to and return value from a function:! <script> function calculate(){ var result = (10, 20) alert(result); function sum(a, b){ return a + b; </script>

12 JavaScript as Function (cont'd)! You can have global and local variables! var pi = ; function area1(r){ return pi * r * r; function area2(r){ var pi = 22/7; return pi * r * r; alert(area1(10)); alert(area2(10)); JavaScript as Function (cont'd)! There are many predefined functions in JS:! alert()! prompt()! confirm()! :

13 Notes on JS Programming! Unlike C, but similar to Java, you can define variables anywhere when you like. So! Correct:! for(var i=0; i<100; i++){ Notes on JS Programming (cont'd)! Since JS is dynamic typing if you want to compare BOTH the values and the data types of two variables, you have to use === and!==! Example:! var x = "5", y = 5; alert(x == y); // return true alert(x === y); // return false alert(x!= y); // return false alert(x!== y); // return true

14 Error Handling! When an error occurs, the JavaScript engine will stop execute immediately.! To have a better error handling, we can use a try-catch strategy:! try{ catch(err){! The program will try to run everything in "try".! If no error occurs, it will ignore anything "catch".! If error occurs anywhere in "try", the program will jump to run everything in "catch" until finished or another error occurs. Error Handling (cont'd)! Example:! try{ var result = sum(10, 20); // the function "sum" is not defined alert(result); catch(err){ alert(err);! Note: you can give any name to the variable "err". E.g.:! catch(err)! catch(e)! catch(exception)

15 JS and Objects! Technically, "Everything" in JavaScript is Object!!! String, Number, Array,! What's so special about Object?! An object is a piece of data, with properties and methods About Objects! A real life example:! Object! Car! Properties:! Brand: BMW! Model: 330i! Color: Silver Grey! Methods:! Start! Run! Brake

16 About Objects (cont'd)! Objects in JS, similar to objects in real life objects, may have properties and methods.! For example, the predefined JS object "String"! Properties:! length - The length of a string! Methods:! replace("xx", "yy") Replace string xx to yy for a given string! touppercase() Change all characters to upper case of a give string About Objects (cont'd)! Let's continue our string example:! var str = "Local"; var len = str.length; // len = 5 var str2 = str.replace("l", "V"); // str2 = Vocal var str3 = str.touppercase(); // str3 = LOCAL var str4 = str.replace("l", "V").toLowerCase(); // str4 = VOCAL! Note: when you access the "methods" of an object, you have to put "()" at the end. If you access the "properties", you do not need to do so.

17 Create You Own Object using JSON! JSON JavaScript Object Notation! Object is delimited by { and. Inside { the properties are defined as name and value pairs (name : value) and separated by commas (, ). Array is defined inside [ ].! Example:! {firstname:"john", lastname:"smith", id:12345, courses: ["seem4570", "seem3490"]! The object (person) in the example above has 4 properties: firstname, lastname, id and courses. Create You Own Object using JSON (cont'd)! To apply JSON in JavaScript:! They are the same:! var person= { firstname : "John", lastname : "Doe", id : 5566, courses: ["seem4570", "seem3550"] ;! To get the values of a property of an object, for example:! var lastname = person.lastname;! var courses = person.courses;! var course = person.courses[1];

18 Create You Own Object using JSON (cont'd)! You can add method as well:! var person= { // same as previous slide printname: function(){ return this.firstname + + this.lastname; printdetail: function(levelofdetail){ if(levelofdetail >= 1){ return this.id + + this.firstname + + this.lastname; else{ return this.id; ;! Try the following:! person.printname(), person.printdetail(0) and person.printdetail(1) JavaScript Framework! To write JavaScript more efficiently, we will usually use some Framework:! You can think about a Framework is a set of ready-to-use functions and objects, so that we do not need to write everything by ourselves!! One of the most powerful and my favorite JavaScript Framework is jquery

19 References! JavaScript:! JSON:!

JavaScript Introduction

JavaScript Introduction JavaScript Introduction Web Technologies I. Zsolt Tóth University of Miskolc 2016 Zsolt Tóth (UM) JavaScript Introduction 2016 1 / 31 Introduction Table of Contents 1 Introduction 2 Syntax Variables Control

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?

More information

XML JavaScript Object Notation JSON Cookies Miscellaneous What Javascript can t do. OOP Concepts of JS

XML JavaScript Object Notation JSON Cookies Miscellaneous What Javascript can t do. OOP Concepts of JS LECTURE-4 XML JavaScript Object Notation JSON Cookies Miscellaneous What Javascript can t do. OOP Concepts of JS 1 XML EXTENDED MARKUP LANGUAGE XML is a markup language, like HTML Designed to carry data

More information

CGS 3066: Spring 2015 JavaScript Reference

CGS 3066: Spring 2015 JavaScript Reference CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within

More information

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017) COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017) RAMANA ISUKAPALLI RAMANA@CS.COLUMBIA.EDU 1 LECTURE-1 Course overview See http://www.cs.columbia.edu/~ramana Overview of HTML Formatting, headings,

More information

Manju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 11

Manju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 11 CS4PM Web Aesthetics and Development WEEK 11 Objective: Understand basics of JScript Outline: a. Basics of JScript Reading: Refer to w3schools websites and use the TRY IT YOURSELF editor and play with

More information

3 The Building Blocks: Data Types, Literals, and Variables

3 The Building Blocks: Data Types, Literals, and Variables chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

More information

CSC Web Programming. Introduction to JavaScript

CSC Web Programming. Introduction to JavaScript CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary

More information

Scripting for Multimedia LECTURE 3: INTRODUCING JAVASCRIPT

Scripting for Multimedia LECTURE 3: INTRODUCING JAVASCRIPT Scripting for Multimedia LECTURE 3: INTRODUCING JAVASCRIPT Understanding Javascript Javascript is not related to Java but to ECMAScript It is widely used for client-side scripting on the web Javascript,

More information

JavaScript: Introduction, Types

JavaScript: Introduction, Types JavaScript: Introduction, Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 19 History Developed by Netscape "LiveScript", then renamed "JavaScript" Nothing

More information

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script What is Java Script? CMPT 165: Java Script Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University November 7, 2011 JavaScript was designed to add interactivity to HTML pages

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary

More information

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010 Lecture 14 Javascript Announcements Project #2 New website Exam#2 No. Class Date Subject and Handout(s) 17 11/4/10 Examination Review Practice Exam PDF 18 11/9/10 Search, Safety, Security Slides PDF UMass

More information

Programming language components

Programming language components Programming language components syntax: grammar rules for defining legal statements what's grammatically legal? how are things built up from smaller things? semantics: what things mean what do they compute?

More information

Variables and Typing

Variables and Typing Variables and Typing Christopher M. Harden Contents 1 The basic workflow 2 2 Variables 3 2.1 Declaring a variable........................ 3 2.2 Assigning to a variable...................... 4 2.3 Other

More information

What is PHP? [1] Figure 1 [1]

What is PHP? [1] Figure 1 [1] PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure

More information

JavaScript Basics. The Big Picture

JavaScript Basics. The Big Picture JavaScript Basics At this point, you should have reached a certain comfort level with typing and running JavaScript code assuming, of course, that someone has already written it for you This handout aims

More information

JavaScript or: How I Learned to Stop Worrying and Love a Classless Loosely Typed Language

JavaScript or: How I Learned to Stop Worrying and Love a Classless Loosely Typed Language JavaScript or: How I Learned to Stop Worrying and Love a Classless Loosely Typed Language Part 1 JavaScript the language What is JavaScript? Why do people hate JavaScript? / Should *you* hate JavaScript?

More information

Lecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

Lecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science) Lecture 14 Introduction to JavaScript Mr. Mubashir Ali Lecturer (Dept. of dr.mubashirali1@gmail.com 1 Outline What is JavaScript? Embedding JavaScript with HTML JavaScript conventions Variables in JavaScript

More information

So, if you receive data from a server, in JSON format, you can use it like any other JavaScript object.

So, if you receive data from a server, in JSON format, you can use it like any other JavaScript object. What is JSON? JSON stands for JavaScript Object Notation JSON is a lightweight data-interchange format JSON is "self-describing" and easy to understand JSON is language independent * JSON uses JavaScript

More information

CSCE 120: Learning To Code

CSCE 120: Learning To Code CSCE 120: Learning To Code Manipulating Data I Introduction This module is designed to get you started working with data by understanding and using variables and data types in JavaScript. It will also

More information

PHP. Interactive Web Systems

PHP. Interactive Web Systems PHP Interactive Web Systems PHP PHP is an open-source server side scripting language. PHP stands for PHP: Hypertext Preprocessor One of the most popular server side languages Second most popular on GitHub

More information

JavaScript CS 4640 Programming Languages for Web Applications

JavaScript CS 4640 Programming Languages for Web Applications JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation

More information

JAVASCRIPT. JavaScript is the programming language of HTML and the Web. JavaScript Java. JavaScript is interpreted by the browser.

JAVASCRIPT. JavaScript is the programming language of HTML and the Web. JavaScript Java. JavaScript is interpreted by the browser. JAVASCRIPT JavaScript is the programming language of HTML and the Web. JavaScript Java JavaScript is interpreted by the browser JavaScript 1/15 JS WHERE TO

More information

c122mar413.notebook March 06, 2013

c122mar413.notebook March 06, 2013 These are the programs I am going to cover today. 1 2 Javascript is embedded in HTML. The document.write() will write the literal Hello World! to the web page document. Then the alert() puts out a pop

More information

CISC 1600 Lecture 2.4 Introduction to JavaScript

CISC 1600 Lecture 2.4 Introduction to JavaScript CISC 1600 Lecture 2.4 Introduction to JavaScript Topics: Javascript overview The DOM Variables and objects Selection and Repetition Functions A simple animation What is JavaScript? JavaScript is not Java

More information

JavaScript CS 4640 Programming Languages for Web Applications

JavaScript CS 4640 Programming Languages for Web Applications JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation

More information

The first sample. What is JavaScript?

The first sample. What is JavaScript? Java Script Introduction JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Firefox, Chrome, Opera, and Safari. In this lecture

More information

Outline. Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages

Outline. Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages JavaScript CMPT 281 Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages Announcements Layout with tables Assignment 3 JavaScript Resources Resources Why JavaScript?

More information

CHAPTER 6 JAVASCRIPT PART 1

CHAPTER 6 JAVASCRIPT PART 1 CHAPTER 6 JAVASCRIPT PART 1 1 OVERVIEW OF JAVASCRIPT JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational objects within

More information

JQuery and Javascript

JQuery and Javascript JQuery and Javascript Javascript - a programming language to perform calculations/ manipulate HTML and CSS/ make a web page interactive JQuery - a javascript framework to help manipulate HTML and CSS JQuery

More information

/ Introduction to XML

/   Introduction to XML Introduction to XML XML stands for Extensible Markup Language. It is a text-based markup language derived from Standard Generalized Markup Language (SGML). XML tags identify the data and are used to store

More information

Such JavaScript Very Wow

Such JavaScript Very Wow Such JavaScript Very Wow Lecture 9 CGS 3066 Fall 2016 October 20, 2016 JavaScript Numbers JavaScript numbers can be written with, or without decimals. Extra large or extra small numbers can be written

More information

(Refer Slide Time: 01:40)

(Refer Slide Time: 01:40) Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #25 Javascript Part I Today will be talking about a language

More information

JavaScript for PHP Developers

JavaScript for PHP Developers JavaScript for PHP Developers Ed Finkler @funkatron coj@funkatron.com May 18, 2010 #tekx #js4php http://joind.in/1564 What is this? 2 A practical overview of JS for the PHP developer Stop c+p'ing, start

More information

Introduction to JSON. Roger Lacroix MQ Technical Conference v

Introduction to JSON. Roger Lacroix  MQ Technical Conference v Introduction to JSON Roger Lacroix roger.lacroix@capitalware.com http://www.capitalware.com What is JSON? JSON: JavaScript Object Notation. JSON is a simple, text-based way to store and transmit structured

More information

jquery and AJAX

jquery and AJAX jquery and AJAX http://www.flickr.com/photos/pmarkham/3165964414/ Dynamic HTML (DHTML) Manipulating the web page's structure is essential for creating a highly responsive UI Two main approaches Manipulate

More information

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

JavaScript s role on the Web

JavaScript s role on the Web Chris Panayiotou JavaScript s role on the Web JavaScript Programming Language Developed by Netscape for use in Navigator Web Browsers Purpose make web pages (documents) more dynamic and interactive Change

More information

JavaScript Introduction

JavaScript Introduction JavaScript Introduction What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means

More information

JavaScript or: HOW I LEARNED TO STOP WORRYING AND LOVE A CLASSLESS*

JavaScript or: HOW I LEARNED TO STOP WORRYING AND LOVE A CLASSLESS* JavaScript or: HOW I LEARNED TO STOP WORRYING AND LOVE A CLASSLESS* LOOSELY TYPED LANGUAGE Two parts Part 1 JavaScript the language Part 2 What is it good for? Part 1 JavaScript the language What is JavaScript?

More information

COMP519 Practical 5 JavaScript (1)

COMP519 Practical 5 JavaScript (1) COMP519 Practical 5 JavaScript (1) Introduction This worksheet contains exercises that are intended to familiarise you with JavaScript Programming. While you work through the tasks below compare your results

More information

<form>. input elements. </form>

<form>. input elements. </form> CS 183 4/8/2010 A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, text area fields, drop-down menus, radio buttons,

More information

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Lecture 04 Software Test Automation: JUnit as an example

More information

Objectives. In this chapter, you will:

Objectives. In this chapter, you will: Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

More information

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser. Controlled Assessment Task Question 1 - Describe how this HTML code produces the form displayed in the browser. The form s code is displayed in the tags; this creates the object which is the visible

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

CIW 1D CIW JavaScript Specialist.

CIW 1D CIW JavaScript Specialist. CIW 1D0-635 CIW JavaScript Specialist http://killexams.com/exam-detail/1d0-635 Answer: A QUESTION: 51 Jane has created a file with commonly used JavaScript functions and saved it as "allfunctions.js" in

More information

CSc 337 LECTURE 5: GRID LAYOUT AND JAVASCRIPT

CSc 337 LECTURE 5: GRID LAYOUT AND JAVASCRIPT CSc 337 LECTURE 5: GRID LAYOUT AND JAVASCRIPT Layouts Flexbox - designed for one-dimensional layouts Grid - designed for two-dimensional layouts Grid Layout Use if you want rows and columns Works similarly

More information

JavaScript Lecture 1

JavaScript Lecture 1 JavaScript Lecture 1 Waterford Institute of Technology May 17, 2016 John Fitzgerald Waterford Institute of Technology, JavaScriptLecture 1 1/31 Javascript Extent of this course A condensed basic JavaScript

More information

FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each):

FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): FORM 1 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): 1. The basic commands that a computer performs are input (get data), output (display result),

More information

5. Assuming gooddata is a Boolean variable, the following two tests are logically equivalent. if (gooddata == false) if (!

5. Assuming gooddata is a Boolean variable, the following two tests are logically equivalent. if (gooddata == false) if (! FORM 2 (Please put your name and form # on the scantron!!!!) CS 161 Exam I: True (A)/False(B) (2 pts each): 1. Assume that all variables are properly declared. The following for loop executes 20 times.

More information

ID1354 Internet Applications

ID1354 Internet Applications ID1354 Internet Applications JavaScript Leif Lindbäck, Nima Dokoohaki leifl@kth.se, nimad@kth.se SCS/ICT/KTH Overview of JavaScript Originally developed by Netscape, as LiveScript Became a joint venture

More information

Web Application Development

Web Application Development Web Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie JavaScript JAVASCRIPT FUNDAMENTALS Agenda

More information

JavaScript code is inserted between tags, just like normal HTML tags:

JavaScript code is inserted between tags, just like normal HTML tags: Introduction to JavaScript In this lesson we will provide a brief introduction to JavaScript. We won t go into a ton of detail. There are a number of good JavaScript tutorials on the web. What is JavaScript?

More information

JavaScript: The Basics

JavaScript: The Basics JavaScript: The Basics CISC 282 October 4, 2017 JavaScript A programming language "Lightweight" and versatile Not universally respected Appreciated in the web domain Adds programmatic functionality to

More information

Introduction to JavaScript

Introduction to JavaScript 127 Lesson 14 Introduction to JavaScript Aim Objectives : To provide an introduction about JavaScript : To give an idea about, What is JavaScript? How to create a simple JavaScript? More about Java Script

More information

2 rd class Department of Programming. OOP with Java Programming

2 rd class Department of Programming. OOP with Java Programming 1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach

More information

MongoDB Web Architecture

MongoDB Web Architecture MongoDB Web Architecture MongoDB MongoDB is an open-source, NoSQL database that uses a JSON-like (BSON) document-oriented model. Data is stored in collections (rather than tables). - Uses dynamic schemas

More information

Midterm Exam. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can.

Midterm Exam. 5. What is the character - (minus) used for in JavaScript? Give as many answers as you can. First Name Last Name CSCi 90.3 March 23, 2010 Midterm Exam Instructions: For multiple choice questions, circle the letter of the one best choice unless the question explicitly states that it might have

More information

JAVASCRIPT - CREATING A TOC

JAVASCRIPT - CREATING A TOC JAVASCRIPT - CREATING A TOC Problem specification - Adding a Table of Contents. The aim is to be able to show a complete novice to HTML, how to add a Table of Contents (TOC) to a page inside a pair of

More information

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP? PHP 5 Introduction What You Should Already Know you should have a basic understanding of the following: HTML CSS What is PHP? PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open

More information

BEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from

BEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from BEFORE CLASS If you haven t already installed the Firebug extension for Firefox, download it now from http://getfirebug.com. If you don t already have the Firebug extension for Firefox, Safari, or Google

More information

CS1520 Recitation Week 2

CS1520 Recitation Week 2 CS1520 Recitation Week 2 Javascript http://cs.pitt.edu/~jlee/teaching/cs1520 Jeongmin Lee, (jlee@cs.pitt.edu) Today - Review of Syntax - Embed code - Syntax - Declare variable - Numeric, String, Datetime

More information

welcome to BOILERCAMP HOW TO WEB DEV

welcome to BOILERCAMP HOW TO WEB DEV welcome to BOILERCAMP HOW TO WEB DEV Introduction / Project Overview The Plan Personal Website/Blog Schedule Introduction / Project Overview HTML / CSS Client-side JavaScript Lunch Node.js / Express.js

More information

Working with JavaScript

Working with JavaScript Working with JavaScript Creating a Programmable Web Page for North Pole Novelties 1 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page 2 Objectives

More information

Client Side JavaScript and AJAX

Client Side JavaScript and AJAX Client Side JavaScript and AJAX Client side javascript is JavaScript that runs in the browsers of people using your site. So far all the JavaScript code we've written runs on our node.js server. This is

More information

Q1. What is JavaScript?

Q1. What is JavaScript? Q1. What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight programming language JavaScript is usually embedded

More information

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads

More information

Session 16. JavaScript Part 1. Reading

Session 16. JavaScript Part 1. Reading Session 16 JavaScript Part 1 1 Reading Reading Wikipedia en.wikipedia.org/wiki/javascript / p W3C www.w3.org/tr/rec-html40/interact/scripts.html Web Developers Notes www.webdevelopersnotes.com/tutorials/javascript/

More information

Object Oriented Programming

Object Oriented Programming Object Oriented Programming Objectives To review the concepts and terminology of object-oriented programming To discuss some features of objectoriented design 1-2 Review: Objects In Java and other Object-Oriented

More information

Wednesday. Wednesday, September 17, CS 1251 Page 1

Wednesday. Wednesday, September 17, CS 1251 Page 1 CS 1251 Page 1 Wednesday Wednesday, September 17, 2014 8:20 AM Here's another good JavaScript practice site This site approaches things from yet another point of view it will be awhile before we cover

More information

Client Side Scripting. The Bookshop

Client Side Scripting. The Bookshop Client Side Scripting The Bookshop Introduction This assignment is a part of three assignments related to the bookshop website. Currently design part (using HTML and CSS) and server side script (using

More information

JavaScript. Like PHP, JavaScript is a modern programming language that is derived from the syntax at C.

JavaScript. Like PHP, JavaScript is a modern programming language that is derived from the syntax at C. Like PHP, JavaScript is a modern programming language that is derived from the syntax at C. It has been around just about as long as PHP, also having been invented in 1995. JavaScript, HTML, and CSS make

More information

<script type="text/javascript"> script commands </script>

<script type=text/javascript> script commands </script> JavaScript Java vs. JavaScript JavaScript is a subset of Java JavaScript is simpler and less powerful than Java JavaScript programs can be embedded within HTML files; Java code must be separate Java code

More information

Chapter 3 Data Types and Variables

Chapter 3 Data Types and Variables Chapter 3 Data Types and Variables Adapted from JavaScript: The Complete Reference 2 nd Edition by Thomas Powell & Fritz Schneider 2004 Thomas Powell, Fritz Schneider, McGraw-Hill Jargon Review Variable

More information

Session 6. JavaScript Part 1. Reading

Session 6. JavaScript Part 1. Reading Session 6 JavaScript Part 1 Reading Reading Wikipedia en.wikipedia.org/wiki/javascript Web Developers Notes www.webdevelopersnotes.com/tutorials/javascript/ JavaScript Debugging www.w3schools.com/js/js_debugging.asp

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

UNIT-4 JAVASCRIPT. Prequisite HTML/XHTML. Origins

UNIT-4 JAVASCRIPT. Prequisite HTML/XHTML. Origins UNIT-4 JAVASCRIPT Overview of JavaScript JavaScript is a sequence of statements to be executed by the browser. It is most popular scripting language on the internet, and works in all major browsers, such

More information

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018)

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018) COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018) RAMANA ISUKAPALLI RAMANA@CS.COLUMBIA.EDU 1 LECTURE-1 Course overview See http://www.cs.columbia.edu/~ramana Overview of HTML Formatting, headings,

More information

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37)

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) A Server-side Scripting Programming Language An Introduction What is PHP? PHP stands for PHP: Hypertext Preprocessor. It is a server-side

More information

Client vs Server Scripting

Client vs Server Scripting Client vs Server Scripting PHP is a server side scripting method. Why might server side scripting not be a good idea? What is a solution? We could try having the user download scripts that run on their

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #33 Pointer Arithmetic

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #33 Pointer Arithmetic Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #33 Pointer Arithmetic In this video let me, so some cool stuff which is pointer arithmetic which helps you to

More information

Frontend II: Javascript and DOM Programming. Wednesday, January 7, 15

Frontend II: Javascript and DOM Programming. Wednesday, January 7, 15 6.148 Frontend II: Javascript and DOM Programming Let s talk about Javascript :) Why Javascript? Designed in ten days in December 1995! How are they similar? Javascript is to Java as hamster is to ham

More information

Darshan Institute of Engineering & Technology for Diploma Studies Unit 2. 2 Working with JavaScript

Darshan Institute of Engineering & Technology for Diploma Studies Unit 2. 2 Working with JavaScript 2 Working with JavaScript JavaScript concept or What is JavaScript? JavaScript is the programming language of the Web. It is an object-oriented language that allows creation of interactive Web pages. It

More information

Object Oriented Programming

Object Oriented Programming Object Oriented Programming Objectives To review the concepts and terminology of object-oriented programming To discuss some features of objectoriented design 1-2 Review: Objects In Java and other Object-Oriented

More information

Introduction to Web Tech and Programming

Introduction to Web Tech and Programming Introduction to Web Tech and Programming Objects Objects Arrays JavaScript Objects Objects are an unordered collection of properties. Basically variables holding variables. Have the form name : value name

More information

A Balanced Introduction to Computer Science, 3/E David Reed, Creighton University 2011 Pearson Prentice Hall ISBN

A Balanced Introduction to Computer Science, 3/E David Reed, Creighton University 2011 Pearson Prentice Hall ISBN A Balanced Introduction to Computer Science, 3/E David Reed, Creighton University 2011 Pearson Prentice Hall ISBN 978-0-13-216675-1 Chapter 5 JavaScript and User Interaction 1 Text Boxes HTML event handlers

More information

Lecture 8 (7.5?): Javascript

Lecture 8 (7.5?): Javascript Lecture 8 (7.5?): Javascript Dynamic web interfaces forms are a limited interface

More information

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Web Programming and Design MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Plan for the next 5 weeks: Introduction to HTML tags, creating our template file Introduction to CSS and style

More information

Background. Javascript is not related to Java in anyway other than trying to get some free publicity

Background. Javascript is not related to Java in anyway other than trying to get some free publicity JavaScript I Introduction JavaScript traditionally runs in an interpreter that is part of a browsers Often called a JavaScript engine Was originally designed to add interactive elements to HTML pages First

More information

ITS331 Information Technology I Laboratory

ITS331 Information Technology I Laboratory ITS331 Information Technology I Laboratory Laboratory #11 Javascript and JQuery Javascript Javascript is a scripting language implemented as a part of most major web browsers. It directly runs on the client's

More information

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users Introduction to PHP Let's Look Back We talked about how to create a form in HTML Forms are one way to interact with users Users can enter information into forms which can be used by you (programmer) We

More information

CSC Web Technologies, Spring Web Data Exchange Formats

CSC Web Technologies, Spring Web Data Exchange Formats CSC 342 - Web Technologies, Spring 2017 Web Data Exchange Formats Web Data Exchange Data exchange is the process of transforming structured data from one format to another to facilitate data sharing between

More information

a Why JavaScript? jonkv interactivity on the web CGI JavaScript Java Applets Netscape LiveScript JavaScript 1: Example

a Why JavaScript? jonkv interactivity on the web CGI JavaScript Java Applets Netscape LiveScript JavaScript 1: Example Why JavaScript? 2 JavaScript JavaScript the language Web page manipulation with JavaScript and the DOM 1994 1995: Wanted interactivity on the web Server side interactivity: CGI Common Gateway Interface

More information

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) What is JavaScript?

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) What is JavaScript? Web Development & Design Foundations with HTML5 Ninth Edition Chapter 14 A Brief Look at JavaScript and jquery Slides in this presentation contain hyperlinks. JAWS users should be able to get a list of

More information

IAT 355 : Lab 01. Web Basics

IAT 355 : Lab 01. Web Basics IAT 355 : Lab 01 Web Basics Overview HTML CSS Javascript HTML & Graphics HTML - the language for the content of a webpage a Web Page put css rules here

More information

First Java Program - Output to the Screen

First Java Program - Output to the Screen First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the

More information

Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras

Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras Module 12B Lecture - 41 Brief introduction to C++ Hello, welcome

More information