Creating dynamic/interactive web pages

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
JavaScript and the DOM Les Carr COMP3001 Les Carr COMP3001.
Document Object Model (DOM) JavaScript manipulation of the DOM.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Lesson 12- Unit L Programming Web Pages with JavaScript.
AJAX (Asynchronous JavaScript and XML) Amit Jain CS 590 – Winter 2008.
Inline, Internal, and External FIle
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
4.1 JavaScript Introduction
JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Lecture 11 – DOM Scripting SFDV3011 – Advanced Web Development Reference: 1.
1 rfXcel Confidential Copyright 2007 Web Technology JavaScript 12/10/07.
Interacting with a Web Page using JavaScript Mat Kelly GTAI Presentation January 10, 2014.
The Document Object Model. The Web B.D, A.D. They aren’t web pages, they’re document objects A web browser interprets structured information. A server.
Client side web programming Introduction Jaana Holvikivi, DSc. School of ICT.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
IS2802 Introduction to Multimedia Applications for Business Lecture 1: Introduction to IS2802 Rob Gleasure
Introduction to JavaScript CS101 Introduction to Computing.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
1 Javascript DOM Peter Atkinson. 2 Objectives Understand the nature and structure of the DOM Add and remove content from the page Access and change element.
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.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
INTRODUCTION JavaScript can make websites more interactive, interesting, and user-friendly.
Event Handling & AJAX IT210 Web Systems. Question How do we enable users to dynamically interact with a website? Answer: Use mouse and keyboard to trigger.
Dave Salinas. What is XML? XML stands for eXtensible Markup Language Markup language, like HTML HTML was designed to display data, whereas XML was designed.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
JavaScript & Introduction to AJAX
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Introduction to JavaScript LIS390W1A Web Technologies and Techniques 24 Oct M. Cameron Jones.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
XML DOM Week 11 Web site:
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
THE DOM.
Introduction to.
DHTML.
Javascript and Dynamic Web Pages: Client Side Processing
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Using JavaScript to Show an Alert
Lecture 11. Web Standards Continued
Intro to JavaScript CS 1150 Spring 2017.
Donna J. Kain, Clarkson University
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
Application with Cross-Platform GUI
AJAX.
JavaScript Using JavaScript.
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
Introduction to JavaScript
JavaScript Introduction
Week 11 Web site: XML DOM Week 11 Web site:
DHTML Javascript Internet Technology.
A second look at JavaScript
DHTML Javascript Internet Technology.
Secure Web Programming
Javascript and JQuery SRM DSC.
Introduction to World Wide Web
Introduction to JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
Chengyu Sun California State University, Los Angeles
Client-Server Model: Requesting a Web Page
CNIT 133 Interactive Web Pags – JavaScript and AJAX
Class 4: Building Interactive Web Pages
Introduction to JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Creating dynamic/interactive web pages JavaScript Creating dynamic/interactive web pages

What is JavaScript? JavaScript is a client-side scripting language that allows for interactive web pages. It differs from PHP because it executes through the web-browser on the client’s machine. PHP runs on the web server. What this means to us is that JavaScript can make incremental changes to the web page, whereas PHP has to rebuild the entire page and transmit it over the web. Developers must be aware that JavaScript may be disabled on the client’s browser or may not be supported on certain devices. JavaScript has a history of facilitating malicious activity through the web browser, but browsers now limit such activity.

How does JavaScript fit into web development? HTML = structural layer of a web page CSS = presentation layer JavaScript = behavioral layer JavaScript can alter: content CSS styles behavior request data from the server and inject it into the webpage without reloading the page (known as Ajax) create collapsible content areas test for individual browser’s features

How do you code JavaScript? To add JavaScript: use <script> </script> tags. Ex: <script scr=”myJavaScript.js”> </script> JavaScript can appear anywhere in the document. Most common in head or at bottom of body. Predefined functions: alert() confirm() prompt() JavaScript is case sensitive. Statements end in ; Comments: // and /* */

The Browser Object (window)

Window Events <button label="Press Me" onclick="alert('You pressed me!');">Press me!</button> <body onclick=”myFuntion();”>

Example

Chapter 20 The DOM Document Object Model (DOM) Gives us a means to access HTML elements by their names or their attributes to add, modify or delete elements and their content. Easiest way to access elements: document.getElementById(“myParagraph”); .innerHTML gets the contents of an element. For example: <p id="demo">This is a paragraph.</p> to update the above document.getElementById("demo").innerHTML=Date();

The DOM hierarchy

Updating the DOM Manipulating nodes: setAttribute( ) Ex. Var bigImage = document.getElementByID(“test-image”); bigImage.setAttribute(“scr”, “largerImage.jpg”); Changing style: document.getElementById(“heading”).style.color = “#ffff00”   Adding or removing elements Using createELement() Ex var newDiv = document.createElement(“div”); createTextNode(“test text line”); appendChild(newDiv) + more …

Polyfill Polyfill- A term referring to JavaScript that normalizes website behavior from browser to browser (to make for out of date browsers). Ex HTML5 shiv – allows older browsers to recognize HTML5 elements. Modernizr – test suite that can be used to detect the presence of browser features and load polyfills as needed. Selectivizr – Allows older versions of IE to understand complex CSS3 elements. Resond.js – used with responsive design and older browsers.

AJAX AJAX – Asynchronous Javascript and XML. Rather than using server-side languages, like PHP for data queries and reload the web page, Javascript can create data access and update relevant portions of the web page. XML or JSON (Javascript Object Notation) is used for data access from server.

JavaScript Libraries Pp 498-499.