[Robert W. Sebesta, “Programming the World Wide Web

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Lesson 12- Unit L Programming Web Pages with JavaScript.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
DT228/3 Web Development JSP: Directives and Scripting elements.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
CST JavaScript Validating Form Data with JavaScript.
4.1 JavaScript Introduction
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
DOM and JavaScript Aryo Pinandito.
Interacting with a Web Page using JavaScript Mat Kelly GTAI Presentation January 10, 2014.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
JavaScript, Fourth Edition
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.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Javascript II DOM & JSON. In an effort to create increasingly interactive experiences on the web, programmers wanted access to the functionality of browsers.
FireBug. What is Firebug?  Firebug is a powerful tool that allows you to edit HTML, CSS and view the coding behind any website: CSS, HTML, DOM and JavaScript.
1 JavaScript
Introduction to JavaScript CS101 Introduction to Computing.
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
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,
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
1 JavaScript in Context. Server-Side Programming.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
JavaScript Overview Developer Essentials How to Code Language Constructs The DOM concept- API, (use W3C model) Objects –properties Methods Events Applications;
 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.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Introduction to JavaScript. Introduction What is it? How does it work? What is Java? Learning JavaScript JavaScript Statements JavaScript and HTML forms.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Javascript and Dynamic Web Pages: Client Side Processing
Programming Web Pages with JavaScript
Applied Component I Unit II Introduction of java-script
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Unit M Programming Web Pages with
Introduction and Principles
JavaScript Event Handling.
Unit M Programming Web Pages with
Intro to JavaScript CS 1150 Spring 2017.
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript.
JavaScript Introduction
DHTML Javascript Internet Technology.
jQuery The Easy JavaScript Nikolay Chochev Technical Trainer
Dynamic Web Pages Jin Wu INF 385E Information Architecture
DHTML Javascript Internet Technology.
Javascript and JQuery SRM DSC.
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
Web Client Side Technologies Raneem Qaddoura
Introduction to JavaScript
[Robert W. Sebesta, “Programming the World Wide Web
Web Application Development Using PHP
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

JavaScript and Form Enhancement CS 4640 Programming Languages for Web Applications [Robert W. Sebesta, “Programming the World Wide Web Jon Duckett, Interactive Frontend Web Development]

JavaScript and Form Forms allow us to collect information from users. JavaScript helps us get the appropriate information from them. Examples of form enhancement with JavaScript: Customizing web pages Making web pages more dynamic Change type of form input Validating forms Manipulating cookies Interacting with frames Calling Java programs

Techniques for Updating HTML Content document.write( ) Advantage Simple way to add content that was not in the original source code to the page Disadvantages Work only when the page initially loads If it is used after the page is loaded, it can Overwrite the whole page Not add the content to the page Create a new page Rarely used by programmers

Techniques for Updating HTML Content element.innerHTML Advantage Easy way to get/update the entire content of an element (including markup) as a string Less code and faster (execution time) than DOM manipulation when adding many new elements to a page Simply way to remove all of the content from one element (by assigning it an empty string) Disadvantages Can pose security risk (thus, should not be used to add content that come from a user) Difficult to isolate single elements to update within a large DOM fragment Event handlers may not work properly

Techniques for Updating HTML Content DOM Manipulation Advantage Easy way to change one element from a DOM fragment where there are many siblings Does not affect event handlers Easily allow a script to add elements incrementally Disadvantages Slower (execution time) than innerHTML when making many changes to the content of a page More code to achieve the same thing compared with innerHTML

JavaScript Tips Build your script one piece at a time Store to files and load with HTML files Do not change variable types Do not use same names for global and local variables Remember, JavaScript is case sensitive Debugger Firefox Javascript debugger – Venkman Another Firefox debugger – Firebug https://addons.mozilla.org/en-US/firefox/addon/216 http://getfirebug.com/

Advantages and Disadvantages Can modify HTML on the client Fairly easy to write simple functions Disadvantages : Weak typing Poor development tools Many scalability problems (maintenance, reliability, readability, security, efficiency, portability, …)

Summary Two common purposes of JavaScript uses: Build HTML dynamically when page is loaded Monitor user events and take action Learning HTML syntax is not hard Learning JS syntax is not hard Designing good dynamic web pages is VERY hard This is a selection of applications – there are more