Client-side processing in JavaScript.... JavaScript history Motivations –lack of “dynamic content” on web pages animations etc user-customised displays.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

Essentials for Design JavaScript Level One Michael Brooks
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
The Web Warrior Guide to Web Design Technologies
Languages for Dynamic Web Documents
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Server-Side vs. Client-Side Scripting Languages
Chapter Concepts Review Markup Languages
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Tutorial 10 Programming with JavaScript
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
CSC 2720 Building Web Applications JavaScript. Introduction  JavaScript is a scripting language most often used for client-side web development.  JavaScript.
JavaScript Demo Presented by … Jaisingh Sumit jain Sudhindra Taran Deep arora.
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
Javascript and the Web Whys and Hows of Javascript.
4.1 JavaScript Introduction
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
HTML Forms and Scripts. Session overview What are forms? Static vs dynamic Client-side scripts –JavaScript.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Programming with JavaScript (Chapter 10). XP Various things Midterm grades: Friday Winter Career Fair – Thursday, April 28, 2011 (11 am to 3 pm). – MAC.
Lesson 19. JavaScript errors Since JavaScript is an interpreted language, syntax errors will usually cause the script to fail. Both browsers will provide.
JavaScript Tabriz university Its September 1995.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
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.
1 JavaScript in Context. Server-Side Programming.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
JavaScript Tutorial 1 - Introduction to JavaScript WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Introduction to JavaScript (NON.
1 3. Computing System Fundamentals 3.1 Language Translators.
An Introduction to JavaScript Summarized from Chapter 6 of “Web Programming: Building Internet Applications”, 3 rd Edition.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
JavaScript Tutorial 1 - Introduction to JavaScript1 Tutorial 1 Introduction to JavaScript Section A – Programming, HTML, and JavaScript.
RUBRIC IP1 Ruben Botero Web Design III. The different approaches to accessing data in a database through client-side scripting languages. – On the client.
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
JavaScript Introduction. Slide 2 Lecture Overview JavaScript background The purpose of JavaScript A first JavaScript example Introduction to getElementById.
1 JavaScript in Context. Server-Side Programming.
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Introduction to JavaScript Fort Collins, CO Copyright © XTR Systems, LLC Introduction to JavaScript Programming Instructor: Joseph DiVerdi, Ph.D., MBA.
“The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Lesson 30: JavaScript and DHTML Fundamentals. Objectives Define and contrast client-side and server-side technologies used to create dynamic content for.
Java Script. What is JavaScript ? It is an scripting language, developed by Netscape Navigator. It can be used to replace CGI scripts for client-side.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
The Web Wizard’s Guide To DHTML and CSS Chapter 2 A Review of CSS2 and JavaScript.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
Active Server Pages v.s. Java Server Pages Presenters: Lan Guo Qunying Fan Pei-Xun Wu Date:
JavaScripts.
Web Development & Design Foundations with HTML5 7th Edition
JavaScript Introduction
JavaScript an introduction.
Tutorial 10 Programming with JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Client-side processing in JavaScript...

JavaScript history Motivations –lack of “dynamic content” on web pages animations etc user-customised displays form checking etc. –Netscape looking for an edge over Microsoft MS swamp market with free high-quality browsers how can Netscape sell browsers….?

JavaScript... Has nothing to do with Java –named for purely political/marketing purposes refers to a class of languages –a different instance for each browser version hugely non-standard –deliberately –becoming less of an issue for the future

variants JavaScript 1.0, 1.1, 1.2, 1.3 (?) –a Netscape trademark JScript 1.0,1.2 (1.3?) –a Microsoft trademark ECMAScript –(European Computer Manufacturers’ Association) –a standard is emerging (ECMA-262) will be ISO-16262

client-side paradigms document appearance and content browser control HTML form interaction user interaction client state read/write various others… –notably applet interaction

The basic model A general-purpose, fully-fledged programming language –actually quite a good one... Not inherently object-oriented –but OO style can be achieved “scripting” language –no real distinction - implementation detail –but - no “compilation” phase

Binding to pages insert html text during load –a tag is evaluated during document load –the identifier “document” binds to the loading document –is “good practice” currently but maybe dated… –avoids mixing HTML and script

The data model Normal mix of types and operators… “dynamic” object model var X = new Object() X.age = 27 X.name = "Fred" Largely untyped –dereference of non-field = UNDEFINED –dereference of UNDEFINED -> dynamic error Run-time environment is very flexible –Lacks safety!

Tricky programming… Software development is extremely tricky –Browsers are main test facility Behaviour is fickle…. –Errors may not be flagged Program may just halt execution –Hardly any support Eg “error line 93, character 17” (HMTL file) –No syntax checking Syntax error leads to run-time failure I have written, just for you, a syntax checker! –

Debug… Typically involves extensive use of “alert” function –Eg alert( “execution is here” ) Eg –var fred = new Object() fred.name = “Fred” document.write( fried.name ) alert( “execution is here” ) Nothing happens…

example load-time script The meaning of life is now = new Date(); document.write( 7 * 6 ); document.write( " in " ); document.write( now.getUTCFullYear() );.

evaluation after load The meaning of life is 42. function f( x ) { alert( x ); }

DHTML A run-time environment for JavaScript Allows scripts to access the document object model of the underlying HTML –Models include DOM Many changes to these objects are auto- refreshed in browsers (esp. IE5.0) –Code can easily change display

the programming environment document –the HTML currently displayed –Contains documentElement field The head of the DOM tree window –the OS window hosting the page navigator –the browser application being used screen –the physical monitor being used

Evaluation contexts client-side - evaluation with browsers –almost all current use server-side –still proprietary Netscape “livewire” server, Microsoft ASP framework embedded –source code of interpreters is freely available allowing scripts to be included in any framework

common example of abuse… function bringItBackAgain( ) { window.open( ” ); }

event handlers What is the meaning of life?

Cookies Outdated – DHTML contains persistent info in a more programmer-friendly form small grains of information that can be stored with the browser application –under the user’s control also –(may be disallowed) can preserve state between accesses –client details –dynamically generate different text for a previous visitor

Scope normal lexicographic scope applies within programs –local: var a = 1 –global: a = 1 Beware eg for( i = 0; …. ) ! default global scope is context-dependent –“document” in a browser functions are scoped like variables watch for dynamic interactions! –browser interface, global scoping

objects, syntax, etc Object-oriented behaviour can be built from basic components –1 st -class code, flexible objects, this binding –Mostly just need to know for using object eg standard libraries etc. for a full understanding, read –Essential JavaScript (Flanagan, O’Reilly) –ECMA standard definition check out Microsoft (msdn) web site