2440: 211 Interactive Web Programming JavaScript Fundamentals.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Introduction to JavaScript
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
The Web Warrior Guide to Web Design Technologies
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
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.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
Getting Started with Java
Introduction to scripting
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
CS102 Introduction to Computer Programming
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Javascript and the Web Whys and Hows of Javascript.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
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.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
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.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
JavaScript Syntax, how to use it in a HTML document
Introduction to JavaScript CS101 Introduction to Computing.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
1 JavaScript in Context. Server-Side Programming.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Creating a Java Application and Applet
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
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.
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.
Chapter 1: Introduction to Computers and Programming.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Module 1 Introduction to JavaScript
Programming Web Pages with JavaScript
Chapter 6 JavaScript: Introduction to Scripting
Tutorial 10 Programming with JavaScript
JavaScript is a programming language designed for Web pages.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Introduction to Scripting
Java programming lecture one
T. Jumana Abu Shmais – AOU - Riyadh
Tutorial 10 Programming with JavaScript
JavaScript Basics What is JavaScript?
An Introduction to JavaScript
Presentation transcript:

2440: 211 Interactive Web Programming JavaScript Fundamentals

2 Programming Language Elements  Key words (reserved words) – words with a special meaning in the programming language  Operators – symbols or words that perform operations on one or more operands  Punctuation – serve specific purposes like marking the beginning and ending of a statement  Programmer-defined names – words or names defined by the programmer  Syntax – rules that dictate how keywords and operators may be used and where punctuation symbols must appear

JavaScript Fundamentals3 Methods of Programming  Two primary methods of programming are:  Procedural – creates programs made up of variables and procedures  Variable – named storage location in a computer’s memory  Procedure – set of programming language statements that perform a specific task  Object-oriented – creates programs made up of objects (instances of a class)  Object – a software entity with attributes (fields) and methods (procedures associated with an object)  Class – specifies the attributes and methods of objects

JavaScript Fundamentals4 Basic JavaScript Tips  All JavaScript programs must be stored in  A Web page’s or element or  A separate file with a.js extension  Comments are ignored by the compiler  JavaScript is case-sensitive  For every opening brace, there must be a corresponding closing brace  JavaScript statements are terminated with semicolons (;), except comments, method headers, or braces  Only when you want to separate statements that are placed on a single line  But it is good practice to end all statements with semicolons

JavaScript Fundamentals5 JavaScript Programs  Run from a Web page as scripts  Can either be:  Placed in a Web page’s or element  Using the element with a type attribute to indicate the scripting language of choice  E.g. JavaScript commands </script>  The language attribute (deprecated) can also be used for HTML documents  E.g. JavaScript commands </script>  Saved in an external text file with a (.js) file extension  Saved JavaScript file is accessed using the element  E.g.

JavaScript Fundamentals6 Comments  Non executable statements  Used to document code  The two JavaScript comments are:  Line comments  E.g. // Line comment here  Paragraph comments  E.g. /* Paragraph comments here */  Used to hide JavaScript code from browsers that do not support JavaScript code  HTML/XHTML comments may be used for this purpose  E.g. <!– Hide from non-JavaScript browsers JavaScript commands // Stop hiding from non-JavaScript browsers --> </script>

JavaScript Fundamentals7 JavaScript Statements  JavaScript is an object-based language  Uses objects by modifying their properties or applying their methods  Object – any software entity with attributes (properties) and procedures (methods)  Example of JavaScript objects include document, window, Date, Math, etc  Property (attribute) – description of an object  E.g. window.status  Procedure (method) – used to perform specific tasks on objects  E.g. document.writeln()  The period (.) is used to distinguish between an object and its properties and procedures  E.g.  document.writeln() // uses the document’s writeln() procedure  window.alert // uses the window’s status property

JavaScript Fundamentals8 Sending Output to a Web Document  The document object’s write( ) and writeln( ) methods are used to send output to a Web page  E.g. document.writeln(“JavaScript is fun…”);  Single line strings must be placed on a single line as shown above  An error is generated when a line break is found  E.g. document.writeln(“JavaScript is fun… “);  If line breaks have to be included use the following methods  Examples: document.writeln(“JavaScript is \ fun… “); document.writeln(“JavaScript is “ + “fun… “);

JavaScript Fundamentals9 Sending Output to a Web Document…  The only difference between the write() and writeln() methods is that the writeln() adds a line break after the output  The difference is only recognized in a element

JavaScript Fundamentals10 Regular Outputs on a Web page <!-- hide from non-JavaScript browsers // Javascript line comments here /* JavaScript paragraph/block comments here document.writeln("Hello..."); document.write("I love JavaScript programming..."); // Stop hiding from non-JavaScript browsers --> </script>

JavaScript Fundamentals11 Outputs within Element <pre> <!-- hide from non-JavaScript browsers // Javascript line comments here /* JavaScript paragraph/block comments here document.writeln("Hello..."); document.write("I love JavaScript programming..."); // Stop hiding from non-JavaScript browsers --> </script></pre>

JavaScript Fundamentals12 Debugging  The process of removing errors in a program  Bug – an error in a program  Types of errors include:  Syntax errors – violates rules of the programming language  Logical errors – cause programs to produce wrong results  Common syntax errors include:  Missing quotes  Mismatched quotes  Mismatched parenthesis or braces  Misspelled user-defined names  Missing punctuations