JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Similar documents
Chapter 1 Programming Languages for Web Applications

Client-side Web Engineering From HTML to AJAX

JavaScript Basics & HTML DOM. Sang Shin Java Technology Architect Sun Microsystems, Inc. sang.shin@sun.com

ICT 6012: Web Programming

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

AJAX The Future of Web Development?

MASTERTAG DEVELOPER GUIDE

Yandex.Widgets Quick start

[ LiB ] [ LiB ] Learn JavaScript In a Weekend By Jerry Lee Ford, Jr. Publisher: Premier Press Pub Date: 2003 ISBN: X Pages: 472

ANGULAR JS SOFTWARE ENGINEERING FOR WEB SERVICES HASAN FAIZAL K APRIL,2014

Web Development 1 A4 Project Description Web Architecture

Website Login Integration

«W3Schools Home Next Chapter» JavaScript is THE scripting language of the Web.

Short notes on webpage programming languages

HTML Tables. IT 3203 Introduction to Web Development

PLAYER DEVELOPER GUIDE

Outline. 1.! Development Platforms for Multimedia Programming!

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

Web Pages. Static Web Pages SHTML

Attacks on Clients: Dynamic Content & XSS

Embedding a Data View dynamic report into an existing web-page

c. Write a JavaScript statement to print out as an alert box the value of the third Radio button (whether or not selected) in the second form.

Further web design: HTML forms

Performance Testing for Ajax Applications

Overview. In the beginning. Issues with Client Side Scripting What is JavaScript? Syntax and the Document Object Model Moving forward with JavaScript

Web Development News, Tips and Tutorials

IT3503 Web Development Techniques (Optional)

Government Girls Polytechnic, Bilaspur

jquery Tutorial for Beginners: Nothing But the Goods

HTML Form Widgets. Review: HTML Forms. Review: CGI Programs

Dynamic Web-Enabled Data Collection

WWW. World Wide Web Aka The Internet. dr. C. P. J. Koymans. Informatics Institute Universiteit van Amsterdam. November 30, 2007

Outline. CIW Web Design Specialist. Course Content

The purpose of jquery is to make it much easier to use JavaScript on your website.

Spectrum Technology Platform

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

IT3504: Web Development Techniques (Optional)

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

Slide.Show Quick Start Guide

Web Design Specialist

SUBJECT CODE : 4074 PERIODS/WEEK : 4 PERIODS/ SEMESTER : 72 CREDIT : 4 TIME SCHEDULE UNIT TOPIC PERIODS 1. INTERNET FUNDAMENTALS & HTML Test 1

JISIS and Web Technologies

the intro for RPG programmers Making mobile app development easier... of KrengelTech by Aaron Bartell

ACCESSING THE PROGRESS OPENEDGE APPSERVER FROM PROGRESS ROLLBASE USING JSDO CODE

WEB PROGRAMMING LAB (Common to CSE & IT)

Citrix StoreFront. Customizing the Receiver for Web User Interface Citrix. All rights reserved.

In order for the form to process and send correctly the follow objects must be in the form tag.

Preface. Motivation for this Book

Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)

Developing XML Solutions with JavaServer Pages Technology

Modern browsers support many technologies beyond (X)HTML, CSS, and JavaScript.

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Building Ajax Applications with GT.M and EWD. Rob Tweed M/Gateway Developments Ltd

It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial.

WIRIS quizzes web services Getting started with PHP and Java

Internet Technologies_1. Doc. Ing. František Huňka, CSc.

AJAX and JSON Lessons Learned. Jim Riecken, Senior Software Engineer, Blackboard Inc.

Making Web Application using Tizen Web UI Framework. Koeun Choi

BizFlow 9.0 BizCoves BluePrint

Website Planning Checklist

CREATING A NEWSLETTER IN ADOBE DREAMWEAVER CS5 (step-by-step directions)

Chapter 13 Computer Programs and Programming Languages. Discovering Computers Your Interactive Guide to the Digital World

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

Using HTML5 Pack for ADOBE ILLUSTRATOR CS5

Fig (1) (a) Server-side scripting with PHP. (b) Client-side scripting with JavaScript.

Pay with Amazon Integration Guide

Client-side programming with JavaScript. Laura Farinetti Dipartimento di Automatica e Informatica Politecnico di Torino laura.farinetti@polito.

Example. Represent this as XML

Technical University of Sofia Faculty of Computer Systems and Control. Web Programming. Lecture 4 JavaScript

Fireworks 3 Animation and Rollovers

Chapter 2: Interactive Web Applications

A Tale of the Weaknesses of Current Client-Side XSS Filtering

ActiveX AJAX ASP. AudioMP3

How to Monitor and Identify Website Issues. 2013, SolarWinds Worldwide, LLC. All rights reserved. Share:

Web Design and Development Program (WDD)

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Major Subject

CIS 467/602-01: Data Visualization

DESIGNING HTML HELPERS TO OPTIMIZE WEB APPLICATION DEVELOPMENT

Courses Breakdown. Technical Web Development

Internet Technologies

COURSE SYLLABUS EDG 6931: Designing Integrated Media Environments 2 Educational Technology Program University of Florida

understand how image maps can enhance a design and make a site more interactive know how to create an image map easily with Dreamweaver

Web application development (part 2) Netzprogrammierung (Algorithmen und Programmierung V)

A set-up guide and general information to help you get the most out of your new theme.

A send-a-friend application with ASP Smart Mailer

JavaScript: Client-Side Scripting. Chapter 6

Understanding Cross Site Scripting

Portals and Hosted Files

Job Ready Assessment Blueprint. Web Design. Test Code: 2750 / Version: 01. Copyright All Rights Reserved.

DIPLOMA IN WEBDEVELOPMENT

Web Design Technology

Transcription:

Programming for Digital Media EE1707 JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK 1

References and Sources 1. DOM Scripting, Web Design with JavaScript and the document object model, Jeremy Keith, Apress, 2005 ISBN: 978-1-59059-533-6 2. Designing with JavaScript, creating dynamic web pagers, Nick Heinle, O Reilly, 2002, ISBN : 978-1565923607 3. Lecture notes and other supporting material on http://people.brunel.ac.uk/~emstaam/ 2

Content of lectures 1. Introduction to JavaScript: Brief History Client-Side and Server-Side JavaScript What is Data Object Model (DOM) Dynamic HTML and Browsers Some elementary concepts and JavaScript Syntax 2. Java Script Syntax Statements Variables and arrays Operators Conditional and looping statements Functions and objects 3

Content of lectures continued 3. Objects and DOM Built-in objects, browser object models Document Object Model (DOM) Client-Side validation of input Programming with JavaScript What can we do to date? 4. Event Handling Event Handlers Image objects 5. Forms Manipulating fields Interactive Forms 4

Content of lectures continued 7. Objects/JSON 8. AJAX 5

Introduction to JavaScript Today s topics: 1. Brief History 2. Client-Side and Server-Side JavaScript 3. What is Document Object Model (DOM) 4. Dynamic HTML and Browsers 5. Some elementary concepts and JavaScript Syntax 6

JavaScript History Was developed by Netscape and Sun Microsystems Not Java To make websites more interesting and dynamic To interact with server side applications and Databases VBScript and Jscript by Microsoft Collaboration with European Computer Manufacturers Association (ECMA) ECMAScript Scripting language tells the browser what to do 7

Facts Can be created using any text editor Case sensitive The code can be included in an HTML document using <script></script> tags but it is better to put your JavaScript code in a separate file filename.js and then call it with the <script> tag Note that the target Browser supports JavaScript otherwise it will be ignored. Ex: <script language="javascript1.6"> Use the body to trigger events that calls specified functions JavaScript used to be included in the <head> - but not anymore The Head section always loads first and then the <body> can safely refer to it Interpreted codes and compiled languages 8

Browser Object Model JavaScript allows you to control how data is presented in a browser Things like: The properties of browser window can be manipulated (e.g. height, width, position) 9

Document Object Model (DOM) By using DOM we can manage and describe the contents of a document Objects contain properties and methods It allows you to define What it is image, form etc. 10

Dynamic HTML Integration of HTML, Cascading Style Sheets (CSS) and JavaScript Principles of DHTML: use HTML to mark up web page into elements use CSS to arrange and manage those elements use JavaScript to dynamically change the appearance and styles Using DHTML you could suddenly create complex animation effects Clash of Browsers!!! 11

Example Define an element: <div id= anelement > This is an element </div> Then use the CSS to apply positioning: #anelement { position: absolute; left: 50px top: 100px } Use DOM property element called layers. The layers having unique ID. And then using JavaScript document.layers[ anelement ] 12

Cascade Style Sheets and JavaScript How a content of a page is represented can be defined by style sheets. The contents of a web page is influenced by style sheets through tags and elements. Cascading Style Sheets (CSS) & CSS-DOM Is a style sheet mechanism that has been specifically developed to meet the needs of Web designers and users. A CSS file can be created and edited manually with a text editor, but one can also write a program in a scripting language i.e. JavaScript that manipulates a style sheet. The CSS Document Object Model is an API for manipulating CSS from within the program. 13

Clash of Browsers A struggle between various browsers W3C involvement DOM standardisation in-built in the latest browsers 14

Client-Side and Serve-Side apps Client-Side What happens on your browser Server-Side What happens on the remote/local server 15

Client-Side JavaScript 1. Generate and modify HTML content on-fly 2. Lively interaction with the user: Multimedia, images, animation (image manipulation), links Pop-up Prompts, alerts and dialog boxes Interactive forms with field validation on client-side 3. Deal with Cookies reset and store 4. Simple computations 5. Manage embedded Java applets and plug-ins 16

Limits of Client-Side JavaScript 1. Limitations in directly drawing graphics 2. Does not really interact with the underlying file systems and OS 3. Cannot support multithreading 4. Unable to use arbitrary network connections but able to load documents from arbitrary URLs 17

Server-Side JavaScript 1. Extends functionality for customised web applications 2. Interaction with database systems via ODBC, JDBC, 3. Read and write server files 4. Invoke programs residing in the server 5. Establish arbitrary network connections 18

Short example 1 <!-- Document : Test 1 Author : emstaam --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title> Test 1 </title> <script type="text/javascript"> function show_alert( ) { alert("i am an alert box!"); } </script> </head> <body> <input type="button" onclick="show_alert( )" value="show alert box" /> </body> </html> 19

Short example 2 Create a file in the same directory as your html file. Call it alertbox.js. Type in: function show_alert( ) { alert ( I am an Alert Box! ); } and save. In your html file write your code: <html> <head> <script src= alertbox.js"> </script> </head> <body> <input type="button" onclick="show_alert( )" value= Show alert box!"> </body> </html> What is the difference between example 1 and 2? 20