Introduction to JavaScript

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

Introduction to JavaScript
JavaScript 101 Lesson 01: Writing Your First JavaScript.
MSc. Publishing on WWW JavaScript. What is JavaScript? A scripting language devised by Netscape Adds functionality to web pages by: Embedding code into.
HTML Recall that HTML is static in that it describes how a page is to be displayed, but it doesn’t provide for interaction or animation. A page created.
Multiple Tiers in Action
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
Javascript and the Web Whys and Hows of 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.
Introduction to JavaScript Kirkwood Continuing Education © Copyright 2014, Fred McClurg All Rights Reserved.
Internet Mark-up Languages CO32036 Part Lecture: Elementary JavaScript.
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.
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,
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.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
JavaScript Syntax, how to use it in a HTML document
An Introduction to JavaScript By: John Coliton Tuesday, November 10, 1998 Center for Teaching and Learning.
Introduction to JavaScript CS101 Introduction to Computing.
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.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality.
© 2000 – All Rights Reserved - Page 1 Introduction to JavaScript Programming Part One.
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
Introduction to Web & HTML
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Beginning JavaScript 4 th Edition. Chapter 1 Introduction to JavaScript and the Web.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Brief Look InTo JavaScript Dr. Thomas Hicks Computer Science Department Trinity University.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Module 1 Introduction to JavaScript
JavaScripts.
Web Basics: HTML/CSS/JavaScript What are they?
Unit M Programming Web Pages with
“Under the hood”: Angry Birds Maze
CIS 388 Internet Programming
CSC 301 Web Programming Charles Frank.
Introduction to ASP By “FlyingBono” 2009_01 By FlyingBono 2009_01
JavaScript Wrap-up.
JavaScript is a programming language designed for Web pages.
Intro to JavaScript CS 1150 Spring 2017.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript Part 2 Organizing JavaScript Code into Functions
JavaScript Introduction
JavaScript an introduction.
Introduction to JavaScript
JavaScript – Part I Mendelsohn.
JAVASCRIPT Pam Kahl | COM 585 | Spring 2010.
Introduction to JavaScript
Tutorial 10 Programming with JavaScript
Document Structure & HTML
JavaScript Overview By Kevin Harville.
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
An Introduction to JavaScript
Introduction to JavaScript
Information Retrieval and Web Design
Introduction to JavaScript
Brief Look InTo JavaScript
The Web Wizard’s Guide to PHP by David A. Lash
Presentation transcript:

Introduction to JavaScript

Topics What is JavaScript? Why JavaScript? Including JavaScript in HTML Hello World Example Script JavaScript Comments

What is JavaScript? Created by Netscape Originally called LiveWire then LiveScript A client-side scripting language Client-side refers to the fact that it is executed in the client (software) that the viewer is using. In the case of JavaScript, the client is the browser. A server-side language is one that runs on the Web server. Examples: PHP, Python Interpreted on-the-fly by the client Each line is processed as it loads in the browser

JavaScript is not Java Completely different types of languages that just happen to be similarly named JavaScript - programs are interpreted in the browser Java - programs are compiled and can be run as stand alone applications

Why JavaScript? It’s easier to learn than most programming languages It allows you to make interactive Web pages It can be fun!

Including JavaScript in HTML Two ways to add JavaScript to Web pages Use the <script>…</script> tag Include the script in an external file -- more about this later in the semester Initially, we will only use the <script>…</script> tag

Hello, World! Typically, in any programming language, the first example you learn displays “Hello, World!” We are going to take a look at a Hello World example and then examine all of its parts.

Hello World in JavaScript <!DOCTYPE html> <html> <head> <title>Hello World Example</title> </head> <body> <script type="text/javascript"> <!-- document.write("<h1>Hello, world!</h1>"); //--> </script> </body> </html>

Hello World Screenshot

The <script>…</script> tag The code for the script is contained in the <script>…</script> tag <script type="text/javascript"> . </script>

Hiding JavaScript from Older Browsers Some older browsers do not support JavaScript We need to tell those browsers to ignore what is in the <script> tag <script type="text/javascript"> <!-- some JavaScript code //--> </script>

Displaying text The document.write() method writes a string of text to the browser <script type="text/javascript"> <!-- document.write("<h1>Hello, world!</h1>"); //--> </script>

Enclosed in quotes -- denotes a "string" document.write() Ends in a semicolon document.write("<h1>Hello,world!</h1>"); Enclosed in quotes -- denotes a "string"

Comments in JavaScript Two types of comments Single line Uses two forward slashes (i.e. //) Multiple line Uses /* and */

Single Line Comment Example <script type="text/javascript"> <!-- // This is my JavaScript comment document.write("<h1>Hello!</h1>"); //--> </script>

Multiple Line Comment Example <script type="text/javascript"> <!-- /* This is a multiple line comment. * The star at the beginning of this line is optional. * So is the star at the beginning of this line. */ document.write("<h1>Hello!</h1>"); //--> </script>

Find the Bug! <script type="text/javascript"> <!-- /* This is my JavaScript comment * that spans more than 1 line. * document.write("<h1>Hello!</h1>"); //--> </script>