4.1. Manage and maintain JavaScript. 4.2. Update the UI by using JavaScript. Understanding JavaScript and Coding Essentials.

Slides:



Advertisements
Similar presentations
JavaScript and the DOM Les Carr COMP3001 Les Carr COMP3001.
Advertisements

Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Introduction to JavaScript Module 1 Client Side JS Programming M-GO Sponsored By
The Web Warrior Guide to Web Design Technologies
Multimedia and the World Wide Web HCI 201 Lecture Notes #8B.
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
UNIT 6 JAVASCRIPT EVENT HANDLERS &WEB BROWSERS DETECTION.
HTML Forms/Events (Instructor Lesson) The Event model HTML Forms Custom Events 1.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
UNIT 3 DYNAMIC WEBSITES WITH CSS AND JAVASCRIPT. OBJECTIVES  CO4 Apply style to a website using CSS.  CO5 Describe the use of scripting when creating.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Chapter 19: Adding JavaScript
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
Internet Mark-up Languages CO32036 Part Lecture: Elementary JavaScript.
JavaScript 1. What is JavaScript? JavaScript allows web authors to create dynamic pages that react to user interaction. It is an Object-based because.
Lecture 11 – DOM Scripting SFDV3011 – Advanced Web Development Reference: 1.
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.
JavaScript, Fourth Edition
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
JavaScript - A Web Script Language Fred Durao
Intro to JavaScript Scripting language –ECMAScript compliant –Client side vs. server side Syntactic rules –White space –Statement end: ; optional –Comments:
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (there is an audio component to this eLesson) © Dr.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
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.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
Introduction To JavaScript. Putting it Together (page 11) All javascript must go in-between the script tags. All javascript must go in-between the script.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
Project 8: Reacting to Events Essentials for Design JavaScript Level One Michael Brooks.
HTML IMAGES. CONTENTS IMG Tag Alt Attribute Setting Width and Height Of An Image Summary Exercise.
COS 125 DAY 20. Agenda Assignment 8 not corrected yet Assignment 9 posted  Due April 16 New course time line Discussion on Scripts 
Web Programming Java Script & jQuery Web Programming.
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Understanding JavaScript and Coding Essentials Lesson 8.
MTA EXAM HTML5 Application Development Fundamentals.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
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.
Introduction to JavaScript LIS390W1A Web Technologies and Techniques 24 Oct M. Cameron Jones.
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.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
THE DOM.
JavaScript and HTML Simple Event Handling 11-May-18.
Programming Web Pages with JavaScript
Week 3: Introduction to Javascript
Week 4: Introduction to Javascript
Intro to JavaScript CS 1150 Spring 2017.
Web Development & Design Foundations with HTML5 7th Edition
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
14 A Brief Look at JavaScript and jQuery.
JavaScript and HTML Simple Event Handling 19-Sep-18.
DHTML.
JavaScript Introduction
DHTML Javascript Internet Technology.
Understanding JavaScript and Coding Essentials
DHTML Javascript Internet Technology.
E-commerce Applications Development
Tutorial 10: Programming with javascript
Creating dynamic/interactive web pages
Web Programming and Design
Web Programming and Design
Introduction to Web programming
JavaScript and HTML Simple Event Handling 26-Aug-19.
JavaScript and HTML Simple Event Handling 4-Oct-19.
Presentation transcript:

4.1. Manage and maintain JavaScript Update the UI by using JavaScript. Understanding JavaScript and Coding Essentials

Agenda JavaScript Functions and Variables jQuery and Third-Party Libraries Locating and Accessing Elements Listening and Responding to Events Updating the Content of Elements Adding Elements

Building Interactive Applications

What is JavaScript?.js

Connecting JavaScript with HTML document.write("Hello World Wide Web"); 1 2

JavaScript Demo This is a boring website! document.write("Hello, World!"); 1

Functions function doSomethingAwesome() { var name = prompt(“What is your name?”); alert(name + “, you just did something awesome!"); }

How to Define a Function function helloWorld() { alert(‘Hello, World!’); } function keyword function name statement everything between the curly braces is a code block

Naming Functions

Definition and Execution of Functions function doSomethingAwesome() { var name = prompt(“What is your name?”); alert(name + “, you just did something awesome!"); } Defining the Function

Variables

How to Declare a Variable var height = 6; variable keyword variable name variable value assignmen t operator

Rules for Naming Variables Variable names must start with a letter, dollar sign ($), or an underscore (_). It must NOT start with a number. Variable names can contain letters, numbers, dollar signs, and underscores, but NOT dashes (-) or periods (.). You cannot use keywords or reserved words. Variables are case sensitive, which means that thisVariable is different from ThisVariable. Use names that describe the information you are storing. If a variable name uses two or more words, capitalize the first letter of ever word AFTER the first word

Types of Data

Comments /*These comments are typically reserved for describing how an entire script file works or to comment out an entire block of script. */ //this function does something awesome! function doSomethingAwesome() { var name = prompt(“What is your name?”); alert(name + “, you just did something awesome!"); } JavaScript

JavaScript Libraries

Objects in JavaScript THIS IS AN OBJECT

Document Object Model (DOM) document attribute text>

Locating and Accessing Elements document.getElementById(‘demo’); objectmethod name parameter

getElementById() Demo Get today's date and add it to an element on the page. document.getElementById("demo").innerHTML=Date();

Events in Programming Event HandlersAssociated Events onsubmit form submission onkeydown onkeypress onkeyup keystrokes onclick onmousedown onmouseup mouse or touchpad clicks onload onunload page loading/unloading onselect item selection

Event Handlers Demo Select some of the text: function myFunction() { document.getElementById('demo').innerHTML = "Selecting text is awesome!"; }

Updating Content in Elements

innerHTML Demo Updating Content document.getElementById("demo").innerHTML=‘Using JavaScript is super fun!’;

The createElement method Make elements, like images, appear on screen with the document object’s createElement method Add the element to the screen using the appendChild() method function show_image(src, width, height, alt) { var img = document.createElement("img"); img.src = src; img.width = width; img.height = height; img.alt = alt; // Adds it to the tag document.body.appendChild(img); } JavaScript <button onclick="show_image (’dog.jpg’, 276,110, ’Stella');"> Display an image! HTML

createElement Demo Creating Elements Display an image! function show_image(src, width, height, alt) { var img = document.createElement("img"); img.src = src; img.width = width; img.height = height; img.alt = alt; // Adds it to the tag document.body.appendChild(img); }

Summary JavaScript Functions and Variables jQuery and Third-Party Libraries Locating and Accessing Elements Listening and Responding to Events Updating the Content of Elements Adding Elements

© 2015 Microsoft Corporation. All rights reserved.