Scott Marino MSMIS Summer Session 1 - 2001 Web Site Design and Authoring Session 8 Scott Marino.

Slides:



Advertisements
Similar presentations
The Web Warrior Guide to Web Design Technologies
Advertisements

Multimedia and the World Wide Web HCI 201 Lecture Notes #8B.
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
20-Jun-15 JavaScript and HTML Simple Event Handling.
Information Technology Center Hany Abdelwahab Computer Specialist.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Lesson 2 Event Handling. Object Event Handlers Most of the objects that make up the Document Object Model respond to asynchronous, user generated events.
Client side programming with JavaScript and DHTML Dr Jim Briggs.
Introduction To JavaScript What JavaScript Is: a general purpose scripting language that allows a static page to interact with users and respond to events.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
CP476 Internet Computing JavaScript and HTML1 1.JavaScript Execution Environment The JavaScript Window object represents the window in which the browser.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 9 Scott Marino.
Introduction to JavaScript. JavaScript Facts A scripting language - not compiled but interpreted line by line at run-time. Platform independent. It is.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Chapter 5 © 2003 by Addison-Wesley, Inc. 1 Chapter 5 JavaScript and HTML Documents.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
JavaScript Part 1.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
2440: 211 Interactive Web Programming Expressions & Operators.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Using Client-Side Scripts to Enhance Web Applications 1.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
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.
Intro to JavaScript. Some simple examples Examples from our webpage Examples from Andrews webpage Today’s Example.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
1 JavaScript 2 JavaScript. 2 Rollovers Most web page developers first use JavaScript for rollovers A rollover is a change in the appearance of an element.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
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.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
Jaana Holvikivi 1 Introduction to Javascript Jaana Holvikivi Metropolia.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Project 8: Reacting to Events Essentials for Design JavaScript Level One Michael Brooks.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
© 2007 D. J. ForemanJS-1 A Light Introduction for Non-programmers JavaScript for Beginners.
COS 125 DAY 20. Agenda Assignment 8 not corrected yet Assignment 9 posted  Due April 16 New course time line Discussion on Scripts 
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
H.Melikyan/4910/031 Programming the World Wide Web JavaScript Dr.Hayk Melikyan Departmen of Mathematics and CS JavaScript and HTML Documents.
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.
Chapter 4 Java Script - Part1. 2 Outlines Introduction to Java Script Variables, Operators and Functions Conditional statements JavaScript Objects Forms.
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.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Copyright © Terry Felke-Morris Web Development & Design Foundations with HTML5 8 th Edition CHAPTER 14 KEY CONCEPTS 1 Copyright.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
5.1 JavaScript Execution Environment
>> Introduction to JavaScript
JavaScript and HTML Simple Event Handling 11-May-18.
Web Development & Design Foundations with HTML5
Web Development & Design Foundations with HTML5 7th Edition
JAVASCRIPTS AND HTML DOCUMENTS
Web Design and Development
Tutorial 10: Programming with javascript
JavaScript Intro.
Web Programming and Design
Presentation transcript:

Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino

MSMIS Summer Session Topics Intro to JavaScript –Objects, Properties, Methods, Events, Values, Operators, and Assignments –JavaScript / Chapter 1 JavaScript Basics –JavaScript / Chapter 2

Scott Marino MSMIS Summer Session What is JavaScript? A programming language Designed to add interactivity to web pages Creates an active user interface Allows for control over browser functions Client-Side execution JavaScript is NOT Java

Scott Marino MSMIS Summer Session Objects, Properties and Methods Objects are named items –Windows –Frames –Forms –Form elements Objects have properties –A window has a title which is a property –A form element has a value Methods –Things that objects can do Windows can open and close Buttons can be clicked Syntax uses parenthesis to denote a method click() or open() document.write() window.open()

Scott Marino MSMIS Summer Session Event Driven Events are actions that a user performs or specific events that occur within the browser –Submitting a form –Moving a mouse over an element –Completion of page loading JavaScript is activated by event handlers –Trigger the named event to execute when a named event

Scott Marino MSMIS Summer Session Event Handlers onAbort - the user aborts page loading onBlur - the user left the object onChange - the user has changed the object onClick - the user has clicked on an object onError - the script has encountered an error onFocus - the user has made an object active onLoad - the object (page) has finished loading

Scott Marino MSMIS Summer Session Event Handlers onMouseover - the cursor moves over an object onMouseout - the cursor moved off the object onSelect - the user selected the contents of an object onSubmit - the user “submits” a form onUnload - the user has left the window

Scott Marino MSMIS Summer Session Value Types Number - any numeric value String - Characters inside quotation marks Boolean - True or False Null - no value Object - any value associated with the object Function - value as returned by the function

Scott Marino MSMIS Summer Session Operators x + y (numeric) adds the values x + y (string) concatenates the values x - y subtracts y from x x * y multiplies x and y x / y divides x by y x % y modulus of x and y (remainder) x++ increments x by 1 x-- decrements x by 1

Scott Marino MSMIS Summer Session Assignments x = y assigns the value of y to x x += y assign the value x + y to x x -= y assign the value x - y to x x *= y assign the value x * y to x x /= y assign the value x / y to x x %= y assign the value x % y to x

Scott Marino MSMIS Summer Session Comparisons x == y Returns true if x and y are equal x != y Returns true if x and y are not equal x > y Returns true if x is greater than y x >= y Returns true if x is equal or greater than y x < y Returns true if x is less than y x <= y Returns true if x is equal or less than y x && y Returns true if x and y are both true x || y Returns true if either x or y is true !x Returns true is x is false

Scott Marino MSMIS Summer Session JavaScript Basics Scripts can be located within the tags or within the tags document.write("Hello World!") Will write “Hello World!” in the web page Document is the object, write is the method, and “Hello World!” is the value passed to the object via the method

Scott Marino MSMIS Summer Session JavaScript Basics Older browsers have difficulty with JavScript –Use commenting technique to solve this

Scott Marino MSMIS Summer Session JavaScript Basics Comments –Comment a single line by starting it with a // –Comment multiple lines by starting it with a /* and ending the comment with a */ This page needs JavaScript –Only displays in older browsers that don’t support JavaScript or in browsers where the user has turned off JavaScript

Scott Marino MSMIS Summer Session JavaScript Basics Alerts –alert(“Welcome to my page”) Confirmations –confirm(“Are you sure?”) returns true or false Prompts –ans = prompt(“How old are you?”,””) ans is assigned the response

Scott Marino MSMIS Summer Session JavaScript Basics If statements –if ( statement ) { true action } else { false action } True and False actions are separated by braces {}

Scott Marino MSMIS Summer Session JavaScript Basics Redirection –window.location=“somepage.htm” –If the browser is JavaScript enabled, the user would be redirected to the new location Browser Detection –navigator.appName=“Netscape” –navigator.appName=“Microsoft Internet Explorer” Plug-in Detection –navigator.plugins{“[Shockwave Flash]”)

Scott Marino MSMIS Summer Session JavaScript Basics Looping –hasQT = false for (i=0; i = 0) { hasQT = true } } Loops through the list of plugins looking for QuickTime

Scott Marino MSMIS Summer Session JavaScript Basics Functions –function saySomething(message) { alert(message) } – Status Bar Messages –Can scroll a message or have an event driven message