This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of.

Slides:



Advertisements
Similar presentations
Playing computer with logic problems Please use speaker notes for additional information!
Advertisements

 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
The Web Warrior Guide to Web Design Technologies
Introduction to JavaScript Please see speaker notes for additional information!
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.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction to scripting
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Week 9 PHP Cookies and Session Introduction to JavaScript.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
PHP Form Introduction Getting User Information Text Input.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
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.
Introduction to ASP.NET Please use speaker notes for additional information!
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Enhancing Websites with JavaScript. How Do You Give Directions? Lots of details? Specific steps? Just the gist? What language?
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Answer questions about assignment.. Starting JavaScript, at my site these examples are under programs and JavaScript. You can see the address for this.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Module 1 Introduction to JavaScript
>> Fundamental Concepts in PHP
Chapter 6 JavaScript: Introduction to Scripting
2.5 Another Java Application: Adding Integers
Project 9 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms.
Chapter 13 - JavaScript/JScript: Introduction to Scripting
Variables, Expressions, and IO
Introduction to Scripting
JavaScript Syntax and Semantics
Accumulators in Programming
JavaScript: Functions.
Chapter 7 - JavaScript: Introduction to Scripting
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Conditions and Ifs BIS1523 – Lecture 8.
Introduction to DOM.
Please use speaker notes for additional information!
JavaScript: Introduction to Scripting
WEB PROGRAMMING JavaScript.
More Loops.
More Loops.
Please use speaker notes for additional information!
We are starting to program with JavaScript
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
We are starting JavaScript. Here are a set of examples
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT
The + can mean concatenate or add
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Chapter 3: Selection Structures: Making Decisions
Relational Operators.
JavaScript CS 4640 Programming Languages for Web Applications
Chapter 3: Selection Structures: Making Decisions
JavaScript: Introduction to Scripting
Web Programming and Design
CS105 Introduction to Computer Concepts JavaScript
Hardware is… Software is…
Did a few weeks ago. tag would work..
Intro to Programming (in JavaScript)
JavaScript CS 4640 Programming Languages for Web Applications
Python Creating a calculator.
Presentation transcript:

This is an introduction to JavaScript using the examples found at the CIS17 website. In previous examples I specified language = Javascript, instead of type = text/Javascript. JavaScript is the default script. In these examples, I embedded the script in the html tags without using the usual html head, title, body etc. This is workable, but I would change this format to include more html in a more professional version.

When I define the variables, I assign them an initial value. Note that as I process, I take in user input and change the values in the memory variables. I also calculate an answer and change the value in that variable.

When I save this code, I save it with a .html or a .htm extension.

The plus sign can mean add or it can mean concatenate. In this example, firstnum + secondnum involved concatenating the two together as one and since I entered 4, 5 the result was the concatenating of those two numbers and I got 45.

One way to make sure it adds is to convert the variables firstnum and secondnum to integers using parseInt(variable name). Then it is clear that you should be adding so the + does the arithmetic.

The comma can be used to separate fields The comma can be used to separate fields. You can also use the concatenate + as you will see in future examples.

The = is the assignment sign which signs the value on the right to the variable name on the left. When you want to do comparisons in an IF statement, you use the == to ask if two variables or literals are equal.

Note that if you enter an a then a divide will be done Note that if you enter an a then a divide will be done. Because I am checking to see if it is equal to * - it it is not equal to * then it will take the else and ot the divide.

Now, I have changed the code so that in the else I check to see if it was a /. If it is the / I do the divide, else I assign 0 to ans.

Now when I enter an a I will take the first else and then the second else and I will assign 0 to ans so I will display The answer is 0.

When a loop is done, you drop to the statement below the loop. This is a while loop that checks before entering the loop.

This is a do loop with the condition checked in the while at the end of the loop. In this loop the statements inside will be executed at least once.

Interesting...