Tutorial 10: Programming with javascript

Slides:



Advertisements
Similar presentations
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Advertisements

Introducing JavaScript
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
The Web Warrior Guide to Web Design Technologies
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.
Web Page Behavior IS 373—Web Standards Todd Will.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to JavaScript. Aim To enable you to write you first 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.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
What is Java Script? An extension to HTML. An extension to HTML. Allows authors to incorporate some functionality in their web pages. (without using CGI.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
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 Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
LOGO Introduction to Client-Side Scripting and JavaScript CHAPTER 9 Eastern Mediterranean University School of Computing and Technology Department of Information.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
1 JavaScript
JavaScript Programming Unit #1: Introduction. What is Programming?
JavaScript Syntax, how to use it in a HTML document
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Sahar Mosleh California State University San MarcosPage 1 JavaScript Basic.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
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.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
COMP403 Web Design JAVA SCRİPTS Tolgay KARANFİLLER.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
1 Server versus Client-Side Programming Server-SideClient-Side.
1 JavaScript in Context. Server-Side Programming.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Pertemuan 5 IT133 Pengembangan Web JavaScript. What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
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.
Module 1 Introduction to JavaScript
Introduction to Client-Side Scripting and JavaScript
Tutorial 10 Programming with JavaScript
JavaScript is a programming language designed for Web pages.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Web Development & Design Foundations with HTML5 7th Edition
My First Web Page document.write("" + Date() + ""); To insert.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
PHP Introduction.
JavaScript.
JavaScript an introduction.
PHP.
CS105 Introduction to Computer Concepts
Tutorial 10 Programming with JavaScript
JavaScript Basics What is JavaScript?
Web Programming– UFCFB Lecture 13
CS105 Introduction to Computer Concepts JavaScript
Presentation transcript:

Tutorial 10: Programming with javascript Session 2: What is JavaScript?

Objectives What is JavaScript? What can JavaScript do? JavaScript – How to Writing JavaScript Statements JavaScript – Where to Writing JavaScript Comments Declaring Variables in JavaScript

What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight programming language JavaScript is an interpreted language (means that scripts execute without preliminary compilation) Everyone can use JavaScript without purchasing a license Are Java and JavaScript the same? NO! Java and JavaScript are two completely different languages in both concept and design! Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++.

What can JavaScript do? JavaScript gives HTML designers a programming tool JavaScript can read and write HTML elements JavaScript can react to events JavaScript can change HTML content JavaScript can change HTML images JavaScript can change HTML styles JavaScript can be used to validate data •JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages •JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element •JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element •JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing •JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser •JavaScript can be used to create cookies - A JavaScript can be used to store and retrieve information on the visitor's computer

Example of JavaScript Use

Other Examples of JavaScript Uses http://grhainfo.org/codingbootcamp2/registration.htm http://www.gcsu.edu

JavaScript – How to.. A JavaScript program can be placed directly in an HTML file or it can be saved in an external text file Insert a client-side script in a Web page when using the script element <script type="text/javascript"> script commands </script>

JavaScript: Script Element In Class Example Writing to the HTML document Changing HTML elements

JavaScript Statements JavaScript is a sequence of statements to be executed by the browser. JavaScript is case-sensitive. A JavaScript statement is a command to a browser. The purpose of the command is to tell the browser what to do. Example: document.write("Hello Dolly"); Unlike HTML, JavaScript is case sensitive - therefore watch your capitalization closely when you write JavaScript statements, create or call variables, objects and functions.

JavaScript Statements In Class Examples JavaScript Code JavaScript Code Block (use of a function)

JavaScript – Where to.. JavaScript can be put in the <body> and in the <head> sections of an HTML page. JavaScript can be embedded in the HTML code. JavaScript can also be placed in external files.

JavaScript: in head, body, and external In Class Examples In body In head External JavaScript file

JavaScript Comments Commenting your code is an important programming practice // comment text for a single line /* comment text for multiple lines

JavaScript Comments Add a single-line comment Add a multi-line comment In-Class Example: Add a single-line comment Add a multi-line comment

JavaScript Variables As with algebra, JavaScript variables are used to hold values or expressions. A variable can have a short name, like x, or a more descriptive name, like carname. Rules for JavaScript variable names: Variable names are case sensitive (y and Y are two different variables) Variable names must begin with a letter, the $ character, or the underscore character

Declaring JavaScript Variables Declaring a variable tells the JavaScript to reserve memory space for the variable. To declare a JavaScript variable, use the statement var variable; where variable is the name assigned to the variable. To declare a JavaScript variable and set its initial value, use var variable = value; where value is the initial value of the variable.

Declaring JavaScript Variables JavaScript data types: Numeric values Text strings Boolean values Null values You must declare a variable before using it.

Declaring JavaScript Variables Numeric value is any number, such as 13, 22.5, -3.14159 etc. Text string is any group of text characters, such as “Hello” or “Happy Holidays!” Must be enclosed within either double or single quotations (but not both) Boolean values accept only true and false values Null value has no value at all

Declaring Variables In Class Example

Declaring Variables In Class Example