Javascript and Basic Programming Concepts. What is a Program? A program is a specific set of instructions written in a computer language to perform a.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Introduction to C Programming
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
LBSC 690 Session #10 Programming, JavaScript Jimmy Lin The iSchool University of Maryland Wednesday, November 5, 2008 This work is licensed under a Creative.
Information Technology Center Hany Abdelwahab Computer Specialist.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
* Just the gist? * Lots of details? * Specific steps? * What language ?
Sequencing Miss Regan. Blood Hound  Does anyone know what the Bloodhound project is?  Video 1 Video 1  Video 2 Video 2  Link to website Link to website.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Week #2 Java Programming. Enable Line Numbering in Eclipse Open Eclipse, then go to: Window -> Preferences -> General -> Editors -> Text Editors -> Check.
01- Intro-Java-part1 1 Introduction to Java, and DrJava Barb Ericson Georgia Institute of Technology June 2008.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
An Introduction to Textual Programming
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
PHP. Why should we learn web programming? No need write socket programming. - You can forget TCP/IP & OSI layers. - Web server handles socket tasks for.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Generations of Programming Languages First generation  Machine Language Second Generation  Assembly Language Third Generation  Procedural language such.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Georgia Institute of Technology Introduction to Java, and DrJava Barb Ericson Georgia Institute of Technology Aug 2005.
Week 9 PHP Cookies and Session Introduction to JavaScript.
Chapter 4 JavaScript and Dynamic Web pages. Objectives Static Web pages Dynamic Web pages JavaScript Variables Assignments. JavaScript Functions –(prompt(“”,””)
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
* Just the gist? * Lots of details? * Specific steps? * What language ?
PROGRAMMING In Lesson 2. STARTER ACTIVITY Complete the starter activity in your python folder – lesson 2 Now we will see how you got on and update your.
Input & Output Functions JavaScript is special from other languages because it can accept input and produce output on the basis of that input in the same.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Enhancing Websites with JavaScript. How Do You Give Directions? Lots of details? Specific steps? Just the gist? What language?
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Input, Output and Variables GCSE Computer Science – Python.
PHP using MySQL Database for Web Development (part II)
>> Introduction to JavaScript
HTML & teh internets.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
Chapter 7 - JavaScript: Introduction to Scripting
Exercises on JavaScript & Revision
JavaScript: Introduction to Scripting
Introduction to Java, and DrJava part 1
CS105 Introduction to Computer Concepts
Introduction to Java, and DrJava
Computer communications
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Web Programming– UFCFB Lecture 13
Introduction to Java, and DrJava part 1
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
Web Programming and Design
This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.
CS105 Introduction to Computer Concepts JavaScript
Hardware is… Software is…
Intro to Programming (in JavaScript)
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

Javascript and Basic Programming Concepts

What is a Program? A program is a specific set of instructions written in a computer language to perform a specified task. Usually comes in an Application file or “.exe”

What are some programming Languages? Python, Java, C, C++, Fortran - General Programming HTML, XML, LaTeX, XHTML - Markup languages CSS – style sheet language SQL, Oracle, MySQL – Database Mathematical, Matlab, Maple – Math Machine Language

How do we program? Have to use a programming language Programming Language: an artificial language designed to communicate instructions to a machine (computer)

How Do You Give Directions? Lots of details? Specific steps? Just the gist? What language?

Giving Directions With JavaScript Just one way of talking to a computer. Not related to Java Useful for games and widgets Useful for websites

Just the Basics Format Output Variables Functions Input Conditionals

Format Goes in head or body or another tag or another file Uses tags Need to specify the language in the tag

Output Statements that tell the computer to print something somewhere. document.write(WhateverYouWantToPrint)

Output Example First JavaScript page document.write(" Hello World ");

Resulting Webpage

Hello Part 2 First JavaScript page document.write(" Hello World "); document.write(" Or Whoever Is Listening ");

And the Webpage

Why Use JavaScript? What if we wanted to calculate 2*3? 2*3=2*3

And the Resulting Webpage

JavaScript Solution First JavaScript page answer = 2*3; document.write("2*3="+ answer);

Resulting JavaScript Webpage

Variables A variable is a letter, word, or phrase that contains information Example: x = 5

Variable Data types Integers – whole numbers (1, -8, 563) Floating Point (float, double) – decimal (3.14, ) Complex – imaginary numbers (3 + 2i) String – words, sentences, phrases (“Hello there.”) Char – one character or letter (‘a’, ‘b’, ‘c’) Boolean – True or False

Another Calculating Example First JavaScript page timesanswer = 2*3; plusanswer = 2+3; document.write("2*3="+ timesanswer + " and 2+3=" + plusanswer);

Along With the Webpage

What if We Want Three Calculations? First JavaScript page answer = 2*3; document.write("2*3="+ answer + " "); answer = 10*5; document.write("10*5="+ answer + " "); answer = 1024*4; document.write("1024*4="+ answer + " ");

What if 100’s of Calculations? Or lots of something else beside calculations? Functions are an answer! Functions can go in the head and be called from the body.

Example Using a Function to Calculate First JavaScript page function calculateAnswers(number1,number2){ timesanswer = number1*number2; document.write(number1 + "*" + number2 + "=" + timesanswer); document.write(" "); } calculateAnswers(2,3); calculateAnswers(10,5); calculateAnswers(1024,4);

First Function Webpage

Not Much Fun Without User Input Can use tags Inside the form tags use tag Some types of input  Text  Button  Checkbox Types have attributes such as size and name Can respond back to the user with an Alert (tiny popup window)

Sample User Input Page First JavaScript page function calculateAnswers(number1,number2){ timesanswer = number1*number2; alert("The answer is: " + timesanswer); } Enter two numbers to be multiplied: Number1: Number2: <input type="BUTTON" value="Calculate Answer" onClick="calculateAnswers(num1.value, num2.value);"

Resulting Webpage Check it out at html html

What About Conditions? If something happens, do something, otherwise do something else... That is the computer can do different things based on some decision.

Try Out and Example Without Decision Making The following website does division of two numbers. Try it out. Be sure to try and divide by html 2.html

How to do a JavaScript Decision If (something happens){ take some action } else{ take a different action }

Something Happens? Symbolmeaning ==Equal to, and yes that is two = signs right next to each other !=Not equal to >Greater than <Less than >=Greate than or equal to <=Less than or equal to

Example With Decision Making Check out 3.html 3.html Be sure to view the page source to see the condition.

More Examples Calculate the average of three test scores Read info and send if over Vote with alert after each button click Vote with alert only after announce the winner button is clicked