JavaScript Bartosz Sakowicz. JavaScript - basics JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create.

Slides:



Advertisements
Similar presentations
Chapter 08: Adding Adding Interactivity Interactivity With With Behaviors Behaviors By Bill Bennett Associate Professor MSJC CIS MVC.
Advertisements

MWD1001 Website Production Using JavaScript with Forms.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
JavaScript (Part 2) CS 183 4/13/2010. JavaScript (Part 2) Will cover: ◦ For.. In ◦ Events ◦ Try.. Catch, Throw ◦ Objects.
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
MSc. Publishing on WWW JavaScript. What is JavaScript? A scripting language devised by Netscape Adds functionality to web pages by: Embedding code into.
Computer Science 103 Chapter 4 Advanced JavaScript.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
Introduction to Javascript. Web Page Technologies To create Web Page documents, you use: To create Web Page documents, you use: HTML – contents and structures.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
JavaScript - a Brief Introduction Anupriya. What is JavaScript Object based (not object oriented) programming language –very limited object creation –a.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
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
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
Internet Mark-up Languages CO32036 Part Lecture: Elementary JavaScript.
JavaScript Informatics for economists I. Introduction Programming language used in web pages. Simple and easy to use – written in HTML document. Client.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
DOM and JavaScript Aryo Pinandito.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
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.
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
An Introduction to JavaScript Summarized from Chapter 6 of “Web Programming: Building Internet Applications”, 3 rd Edition.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
Javascript. What is JavaScript? Scripting (interpreted) language designed for the web Beware: JavaScript is case sensitive.
Intro to JavaScript. Some simple examples Examples from our webpage Examples from Andrews webpage Today’s Example.
44238: Dynamic Web-site Development Client Side Programming Ian Perry Room:C48 Extension:7287
1 JavaScript 2 JavaScript. 2 Rollovers Most web page developers first use JavaScript for rollovers A rollover is a change in the appearance of an element.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
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.
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,
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.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
© 2007 D. J. ForemanJS-1 A Light Introduction for Non-programmers JavaScript for Beginners.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Web Programming Java Script & jQuery Web Programming.
HTML FORMS The TEXT Object Presented By: Ankit Gupta.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
5 th and 4 th ed: some from chapters 9, 12, 13 SY306 Web and Databases for Cyber Operations Slide Set #8: Dynamic HTML.
Web Development JavaScript. Introduction to JavaScript.
JavaScript Event Handlers. Introduction An event handler executes a segment of a code based on certain events occurring within the application, such as.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
Chapter 4 Java Script - Part1. 2 Outlines Introduction to Java Script Variables, Operators and Functions Conditional statements JavaScript Objects Forms.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript Introduction JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer,
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
COM621: Advanced Interactive Web Development Lecture 5 – JavaScript.
Web Development & Design Foundations with HTML5
JavaScript is a programming language designed for Web pages.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
JavaScript.
DHTML Javascript Internet Technology.
DHTML Javascript Internet Technology.
JavaScript Defined General Syntax Body vs. Head Variables Math & Logic
CS105 Introduction to Computer Concepts
Web Design and Development
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
Web Programming– UFCFB Lecture 13
JavaScript and Ajax (JavaScript Events)
CS105 Introduction to Computer Concepts JavaScript
Presentation transcript:

JavaScript Bartosz Sakowicz

JavaScript - basics JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more. JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Mozilla, Firefox, Netscape, Opera.

JavaScript – basics (2) JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language It is free Java != JavaScript !!!

JavaScript - examples <!– document.write(“It is JavaScript!") //-->

JavaScript – examples(2) function pushbutton() { alert(“Hello!"); }

JavaScript – examples(3) function getname(str) { alert("Hi, "+ str+"!"); } Enter your name:

Inserting JavaScript 1) section (as in previous transparencies) 2)Inline scripts:.... 3) External file:

Hierarchy of objects

Basics usage of objects a) With dot (.) – the same as in C++ (preferred way) b) With usage the table of properties of object, eg: document[1] – useful with loops c) With usage of association table: document["href"]

Expressions & operators x=7; // variables doesn’t have type! str = “Some text"; (bool1 == true) && (bool2 == false); str = “Some" + " text"; All the operators are identical as in C++/Java.

Control flow statements StatementExample usage breakfor(i=1; i<5; i++) { // expressions break; } continueThe same as break. forSee break.. for..infor (i in obj) {// expressions} gotogoto label1; if..elseif(condition) {// expressions if true } else {// expressions if false } returnfunction sum(a,b) {x=a+b; return x;} while do-while while(condition) {//expressions} do { //expressions } while (condition) withwith (document) { write " Some text ";}

Events - onload and onUnload Events are triggered when the user enters or leaves the page. The onload event is often used to check the visitor's browser type and browser version, Events are often used to deal with cookies that should be set when a user enters or leaves a page. Eg:

Events - onFocus, onBlur and onChange Events are often used in combination with validation of form fields. Eg: <input type="text" size="30“ id=" " onchange="check ()">;

Events - onSubmit Event is used to validate all form fields before submitting it. Eg: <form method="post" action="xxx.htm" onsubmit="return checkForm()">

Events - onMouseOver and onMouseOut Events are often used to create "animated" buttons, eg: <!-- function changeImage(i,j) { document.images[i].src = “image"+j+".gif"; }-->