JavaScript.

Slides:



Advertisements
Similar presentations
JavaScript (Part 2) CS 183 4/13/2010. JavaScript (Part 2) Will cover: ◦ For.. In ◦ Events ◦ Try.. Catch, Throw ◦ Objects.
Advertisements

29 November JavaScript: Arrays and Iterations Functions.
Computer Science 103 Chapter 4 Advanced JavaScript.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
JavaScript onLoad getElement. onload Using JavaScript to create content No user input Comes up when page LOADS [redo Koozebane; random picture]
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
JavaScript Part 1.
JavaScript Informatics for economists I. Introduction Programming language used in web pages. Simple and easy to use – written in HTML document. Client.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
Intro to JavaScript Scripting language –ECMAScript compliant –Client side vs. server side Syntactic rules –White space –Statement end: ; optional –Comments:
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Introduction to Programming JScript Six Scripting functions Discuss functions Password Example.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
Event JavaScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is.
Active X – Mouse Events. Structured Graphics Control  Included in Internet Explorer v5.0  Add to page with the OBJECT tag  Accessible via scripting.
Jaana Holvikivi 1 Introduction to Javascript Jaana Holvikivi Metropolia.
IS2802 Introduction to Multimedia Applications for Business Lecture 3: JavaScript and Functions Rob Gleasure
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
JavaScript Event Handlers. Introduction An event handler executes a segment of a code based on certain events occurring within the application, such as.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
GetElementById changes outside forms. From form to page  Identified the field by using name  Form.field  Outside a form, use id  Unique on the page.
Link. setTimeout() What if you want to automatically cycle through the pics? So you don’t have to keep clicking the button to see the next pic Use the.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
1 Lesson 6 Introducing JavaScript HTML and JavaScript BASICS, 4 th Edition.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
JAVASCRIPT A quick review. True False ■The DOM is a standardized way of referring to parts of a Web page. ■TRUE ■In the DOM, attributes have their own.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Third lecture Event 27/2/2016 JavaScript Tutorial.
Build in Objects In JavaScript, almost "everything" is an object.
Java Script Introduction. Java Script Introduction.
Week 3: Introduction to Javascript
JavaScript (JS) Basics
JavaScript, continued.
Chapter 4: Decision Structures and Boolean Logic
Javascript Conditionals.
JavaScript.
14 A Brief Look at JavaScript and jQuery.
DHTML Javascript Internet Technology.
Your 1st Programming Assignment
Event Driven Programming & User Defined Functions
DHTML Javascript Internet Technology.
The Web Wizard’s Guide To JavaScript
JavaScript Defined General Syntax Body vs. Head Variables Math & Logic
Chapter 4: Decision Structures and Boolean Logic
Functions, Regular expressions and Events
JavaScript onLoad arrays
Web Design and Development
Training & Development
Code Topic 9 Standard JavaScript Events Laura Friedman
Writing to the Page Formatting Forms
Web Programming and Design
Chapter 4: Decision Structures and Boolean Logic
Web Programming and Design
Web Programming and Design
Introduction to Web programming
Presentation transcript:

JavaScript

JavaScript needs to be “called” Need an event to change things Mouse actions onclick onmouseover onmouseout Other events: when a new page is loaded onload

onload Using JavaScript to create content No user input Comes up when page LOADS <body onload=“doitnow();”>

Calling JavaScript Inside of HTML Statement can be On □ □ □ □ = “JavaScript stmt;” Statement can be assignment statement function call

function Collection of instructions Can be called many times Called as a single statement

JavaScript function Set of instructions Followed step by step in order Statement types: Variable declarations Assignment statements Functions calls Conditional statements

Declared Variables Explicitly define them Can give them starting values JavaScript figures out data type

Data Types Strings Literals can be in ‘’ or “” Set of functions that work on them Numbers Own set of functions, including Math functions Booleans True or false Own set of operators

Assignment Statements Give a value to Value can be Variable Form field HTML element Variables Literals Operators Functions Form fields HTML elements

Conditional Statements (1 of 3) Execute statements if the condition is true if (score==10) { returnmsg = "Awesome! "; } Execute one of 2 groups of statement depending On whether true or false if (score==10) { returnmsg = "Awesome! "; } else { returnmsg = "Keep trying! ";

Conditional Statements (2 of 3) Execute group of statements depending on which condition is true if (num < 60) { grade = "F"; } else if (num < 70) { grade = "D"; } else if (num < 80) { grade = "C"; } else if (num < 90) { grade = "B"; } else { grade = "A"; }

Conditional Statements (3 of 3) Execute each statement in order Can execute all if’s if (weather == "Sunny") { text = text + weather; } if (day == 0) { text = text + " Sunday"; text = text + " is "; if (temp < 60) { text = text + "cool"; else { text = text + "nice";