The Information School of the University of Washington Oct 20fit100-11-programming1 Programming Basics INFO/CSE 100, Fall 2006 Fluency in Information Technology.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, September 19, 2013 Session 3: JavaScript.
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
The Web Warrior Guide to Web Design Technologies
Computer Science 103 Chapter 3 Introduction to JavaScript.
1 The Information School of the University of Washington Oct 30fit review Programming Review INFO/CSE 100, Fall 2006 Fluency in Information Technology.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
The Information School of the University of Washington Oct 23 fit functions 1 Functions / If Else INFO/CSE 100, Fall 2006 Fluency in Information.
Tutorial 10 Programming with JavaScript
JavaScript, Fourth Edition
JavaScript, Third Edition
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to scripting
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
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
DHTML AND JAVASCRIPT Genetic Computer School LESSON 5 INTRODUCTION JAVASCRIPT G H E F.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
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.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
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.
CIS 375—Web App Dev II JavaScript I. 2 Introduction to DTD JavaScript is a scripting language developed by ________. A scripting language is a lightweight.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
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.
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.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
REEM ALMOTIRI Information Technology Department Majmaah University.
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.
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
Build in Objects In JavaScript, almost "everything" is an object.
Chapter 6 JavaScript: Introduction to Scripting
JavaScript is a programming language designed for Web pages.
Overview: Programming Concepts
PHP Introduction.
JavaScript.
Intro to PHP & Variables
JavaScript an introduction.
Introduction to JavaScript
INFO/CSE 100, Spring 2005 Fluency in Information Technology
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
JavaScript What is JavaScript? What can JavaScript do?
INFO/CSE 100, Spring 2006 Fluency in Information Technology
Tutorial 10 Programming with JavaScript
JavaScript What is JavaScript? What can JavaScript do?
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Tutorial 10: Programming with javascript
Programming Basics Review
Presentation transcript:

The Information School of the University of Washington Oct 20fit programming1 Programming Basics INFO/CSE 100, Fall 2006 Fluency in Information Technology

The Information School of the University of Washington Oct 20fit programming2 Readings and References Reading »Fluency with Information Technology Chapter 18, Fundamental Concepts Expressed in JavaScript Chapter 19, The Bean Counter Other References »WebDeveloper.com »Thomas Jefferson National Accelerator Facility, Office of Science Education »W3Schools Javascript Home

The Information School of the University of Washington Oct 20fit programming3 The Plan We will learn JavaScript over the next few lectures JavaScript is used with HTML in Web pages JavaScript is a contemporary programming language -- we will learn only its basics You will program in a text editor and run your program with your browser JavaScript is a way to make HTML “dynamic”

The Information School of the University of Washington Oct 20fit programming4 Begin with HTML Basic HTML is static the contents of the file are displayed as given <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " Simple A What is ?

The Information School of the University of Washington Oct 20fit programming5 Browser interprets your page You are telling the browser what to do »using HTML for the static parts of the page Simple A What is ? This page is written in the HTML language. Here is some header information about the page. Here is the main body of the page.

The Information School of the University of Washington Oct 20fit programming6 Add some “dynamic” content Scripting languages let us create active pages »implement actions to be taken at run-time when the page is loaded or in response to user event Simple B var greeting = "Hello World!"; document.write(greeting); What is ?

The Information School of the University of Washington Oct 20fit programming7 JavaScript in an HTML page Simple B var greeting = "Hello World!"; document.write(greeting); What is ? block in block in Language we are using is javascript Generate HTML “on the fly” with document.write(...)

The Information School of the University of Washington Oct 20fit programming8 Browser interprets your page You are telling the browser what to do »using HTML for the static parts of the page »using JavaScript for the more dynamic parts Simple B var greeting = "Hello World!"; document.write(greeting); What is ? Here is some script initialization information. Here is some script for the body of the page.

The Information School of the University of Washington Oct 20fit programming10 Variables In Real Life A variable is a "container" for information you want to store »The name of the variable stays the same, but the value associated with that name can change That’s why it’s called a “variable”!

The Information School of the University of Washington Oct 20fit programming11 Variables In Programming Program variables have names and values »Names (also called identifiers) generally start with a letter and can contain letters, numbers, and underscore characters “_” Names are case sensitive No spaces! »Values can be numbers, strings, boolean, etc change as the program executes

The Information School of the University of Washington Oct 20fit programming12 NOTE: The equals sign = is used differently in math and programming. Assign a value to a variable The universal form of the assignment statement »variable gets value balance gets the value 52 greeting gets the value “Hello World!” Each language expresses “gets” in a particular way »JavaScript uses the single equals sign = var balance = 52; var greeting = "Hello World!"; var keyword variable identifier (name) value

The Information School of the University of Washington Oct 20fit programming13 Variable Declarations var eyeColor; <<< undefined! var eyeColor = "green"; <<< initialized var eyeColor = ""; <<< initilized, empty var eyeColor = "green", hairColor="blonde"; hairColor = "carmel"; <<< variable assignment

The Information School of the University of Washington Oct 20fit programming14 Basic Data Types in Javascript Numbers: var gasPrice = 2.55; Strings var eyeColor = "hazel green"; Boolean var isFriday = true; var isWeekend = 0;

The Information School of the University of Washington Oct 20fit programming15 Special String Characters All English letters and numbers are valid. Most English punctuation is valid. There are some special string characters which we use with an escape sequence \" double quote \' single quote \/ forwardslash \\ backslash var nikeQuote = "\"Just Do It!\"";

The Information School of the University of Washington Oct 20fit programming16 JavaScript Variables Simple C var greeting = "Hello World!"; var balance = 52; var transaction = 12; document.writeln(" "+greeting+" "); document.writeln(" My HuskyCard balance is $"+balance+". "); document.writeln(" The next transaction will be for $"+transaction+". "); document.writeln(" What will the new balance be? ");

The Information School of the University of Washington Oct 20fit programming17 Expressions The right-hand side of an assignment statement can be any valid expression Expressions are “formulas” saying how to manipulate existing values to compute new values balance = balance - transaction; seconds = 60*minutes; message = "Status code is " + codeValue; isFreezing = (temp < 32);

The Information School of the University of Washington Oct 20fit programming18 Operators Use operators to build expressions »Numeric operators + - * / mean add, subtract, multiply, divide = 6 »String operator + means concatenate strings "3" + "3" = "33" »Relational operators = > mean less than, less than or equal to, equal to, not equal to, greater than or equal to, greater than »Boolean operators && || ! mean and, or, not

The Information School of the University of Washington Oct 20fit programming19 JavaScript Expressions Simple D var balance = 52; var transaction = 12; document.writeln(" My Husky Card balance is $"+balance+". "); document.writeln(" The next transaction will be for $"+transaction+". "); balance = balance - transaction; document.writeln(" The new balance will be $"+balance+". ");

The Information School of the University of Washington Oct 20fit programming20 Practice, practice, practice Write a simple web page with a simple script like the ones here Save it to disk Open the web page with your browser Does it look like what you expected? »Edit, save, reload »...

The Information School of the University of Washington Oct 20fit programming21