Introduction to JavaScript MIS 403 Classifications of Languages High-Level vs Low LevelHigh-Level vs Low Level –Remember that Information Technology.

Slides:



Advertisements
Similar presentations
The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Java Script Session1 INTRODUCTION.
Introduction to JavaScript
JavaScript Objects - DOM CST 200 JavaScript. Objectives Introduce JavaScript objects Introduce Document Object Model Introduce window object Introduce.
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
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
MSc. Publishing on WWW JavaScript. What is JavaScript? A scripting language devised by Netscape Adds functionality to web pages by: Embedding code into.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Introduction to scripting
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
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
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Scripting Languages.
Introduction to JavaScript 11 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 14.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
Generations of Programming Languages First generation  Machine Language Second Generation  Assembly Language Third Generation  Procedural language such.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript 1. What is JavaScript? JavaScript allows web authors to create dynamic pages that react to user interaction. It is an Object-based because.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
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.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
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 Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
JavaScript Overview Developer Essentials How to Code Language Constructs The DOM concept- API, (use W3C model) Objects –properties Methods Events Applications;
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.
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.
Introduction to JavaScript. Introduction What is it? How does it work? What is Java? Learning JavaScript JavaScript Statements JavaScript and HTML forms.
Chapter 4 Java Script - Part1. 2 Outlines Introduction to Java Script Variables, Operators and Functions Conditional statements JavaScript Objects Forms.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
The Web Wizard’s Guide To DHTML and CSS Chapter 2 A Review of CSS2 and JavaScript.
Brief Look InTo JavaScript Dr. Thomas Hicks Computer Science Department Trinity University.
Module 1 Introduction to JavaScript
“Under the hood”: Angry Birds Maze
JavaScript is a programming language designed for Web pages.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Donna J. Kain, Clarkson University
Web Development & Design Foundations with HTML5 7th Edition
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
14 A Brief Look at JavaScript and jQuery.
JavaScript Introduction
The Web Wizard’s Guide To JavaScript
DHTML Javascript Internet Technology.
Your 1st Programming Assignment
DHTML Javascript Internet Technology.
Introduction to JavaScript
JavaScript Basics What is JavaScript?
Java Script Siddharth Srivastava.
JavaScript is a scripting language designed for Web pages by Netscape.
Introduction to Programming and JavaScript
CNIT 133 Interactive Web Pags – JavaScript and AJAX
Brief Look InTo JavaScript
Presentation transcript:

Introduction to JavaScript MIS 403

Classifications of Languages High-Level vs Low LevelHigh-Level vs Low Level –Remember that Information Technology is VERY layered Compiled vs InterpretedCompiled vs Interpreted Structured vs Object OrientedStructured vs Object Oriented Scripting vs ProgrammingScripting vs Programming

Java vs JavaScript Java - Programming Language (PL)Java - Programming Language (PL) –Interactive Web Graphics –Creating web browser applications –Writing stand-alone applications JavaScript - Scripting LanguageJavaScript - Scripting Language –Runs within the context of the Web browser –Customizing pages based on browser version –Visual Feedback to user actions –Validating data entered on HTML Forms In reality, Java and JavaScript are unrelated…In reality, Java and JavaScript are unrelated…

Web Scripting Languages Combine PL tools to make easier to useCombine PL tools to make easier to use Fewer featuresFewer features Less versatileLess versatile Can be client side or Server sideCan be client side or Server side –Server side – Invoked from browserInvoked from browser Run on the serverRun on the server –Client side - JavaScript Invoked and Run on the browserInvoked and Run on the browser

JavaScript Extends functionality of Web pagesExtends functionality of Web pages Written in the HTML DocumentWritten in the HTML Document Controls page elementsControls page elements Reacts to user actionsReacts to user actions Instructions - code downloaded as textInstructions - code downloaded as text Platform independentPlatform independent Object OrientedObject Oriented

Object Oriented Objects haveObjects have –Qualities or attributes –Things they can do In JavaScript these areIn JavaScript these are –Properties –Methods

Object Examples

JavaScript Object Example To Reference Properties and methods To Reference Properties and methods – document.title –document.bgColor – document.writeln( My Heading )

Fundamental Concepts Objects: The nouns of the languageObjects: The nouns of the language Instances: incarnations of objectsInstances: incarnations of objects Properties: attributes or state of objectsProperties: attributes or state of objects Methods: The verbs of the language that define the behaviors of objectsMethods: The verbs of the language that define the behaviors of objects Events and Events HandlersEvents and Events Handlers

JavaScript Variables Variables: containers for dataVariables: containers for data –All variables have NameName Type – JavaScript is loosely typedType – JavaScript is loosely typed Value or “null”Value or “null” To declare a variableTo declare a variable –var variablename Beware of reserved words (book page 558)Beware of reserved words (book page 558)

The Document Object Model Internal road map of objects on a web pageInternal road map of objects on a web page Hierarchical model of web browser objectsHierarchical model of web browser objects Old DOMs for Netscape, MicrosoftOld DOMs for Netscape, Microsoft New browsers use the standard DOM by W3CNew browsers use the standard DOM by W3C

Embedding JavaScript in HTML As statements and functions via tagAs statements and functions via tag – javascript statements...if not external – javascript statements...if not external –Attributes Ttype, SRCTtype, SRC Within HTML tags as event handlers… LaterWithin HTML tags as event handlers… Later –Provide the doorway between HTML and Scripts

A Word About Comments JavaScript CommentsJavaScript Comments –These comments must be within a script –// begins a single line comment These can start anywhere on the line, but the remainder of the line becomes a commentThese can start anywhere on the line, but the remainder of the line becomes a comment –/* All of your comments here… */ Everything between the start and end comment markers are commentsEverything between the start and end comment markers are comments Can be on a single line or span many…Can be on a single line or span many… HTML CommentsHTML Comments – –

JavaScript in HTML, Template <head> My page with javascript My page with javascript </head><body) <!-- begin hiding here javascript statements… // end hiding here --> </script><noscript> the page requires a browser with javascript the page requires a browser with javascript </noscript>...

JavaScript in HTML, Examples Write and Writeln methods of documentWrite and Writeln methods of document –…./10-04 intro/jsexmp1.html –…./jsexmp1A.html Alerts, Confirmations and PromptsAlerts, Confirmations and Prompts –…/jsalert.html –…/jsconfirm.html –…/jsprompt.html –…/jsprompt2.html

Events and Functions Many event handlers are supportedMany event handlers are supported –onmouseover, onmouseout, onclick –…/swap image.html Functions have Three partsFunctions have Three parts –The function keyword –Parenthesized, comma-separated list of arguments –Statements enclosed in curly brackets –…/function ex.html

Attributes and Reusable code You can pass attribute to a functionYou can pass attribute to a function –…///jsfunct.html Use the src attribute of the tag to reuse codeUse the src attribute of the tag to reuse code –…/jsfunct2.html

JavaScript Lab Exercise 1 Create a web page that containsCreate a web page that contains –A title of “My first JavaScript Page” –A Javascript to ask the user for their name –A personalized welcome message to the user. Create another page that combines image swap and function exampleCreate another page that combines image swap and function example –Have the function called from the button switch the images