CSS Colors, JavaScript Variables, Conditionals and Basic Methods

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

Slide 1 MIS3023 Professor: Akhilesh Bajaj The University of Tulsa.
 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
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.
Information Technology Center Hany Abdelwahab Computer Specialist.
CIS101 Introduction to Computing Week 09 Spring 2004.
Introduction to scripting
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Murach’s JavaScript, C2© 2009, Mike Murach & Associates, Inc.Slide 1.
Java Programming Constructs 1 MIS 3023 Business Programming Concepts II The University of Tulsa Professor: Akhilesh Bajaj All slides in this presentation.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
 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.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
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.
 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.
JavaScript History and Versions JavaScript was introduced as part of the Netscape 2.0 browser Microsoft soon released its own version called JScript ECMA.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
JavaScript 1 COE 201- Computer Proficiency. Introduction JavaScript scripting language ▫Originally created by Netscape ▫Facilitates disciplined approach.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
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.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
REEM ALMOTIRI Information Technology Department Majmaah University.
Learning Javascript From Mr Saem
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
INTERNET APPLICATIONS CPIT405 JavaScript Instructor: Rasha AlOmari
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
CSS Colors, JavaScript Variables, Conditionals and Basic Methods
Chapter 6 JavaScript: Introduction to Scripting
JavaScript is a programming language designed for Web pages.
© 2015, Mike Murach & Associates, Inc.
JavaScript Syntax and Semantics
JavaScript.
Chapter 19 JavaScript.
JavaScript an introduction.
Objectives Insert a script element Write JavaScript comments
The relational operators
Exercises on JavaScript & Revision
© 2015, Mike Murach & Associates, Inc.
© Akhilesh Bajaj, All rights reserved.
WEB PROGRAMMING JavaScript.
The Internet 12/8/11 JavaScript Review
© 2015, Mike Murach & Associates, Inc.
T. Jumana Abu Shmais – AOU - Riyadh
The Internet 11/15/11 Handling Data in JavaScript
The Internet 11/22/11 Conditionals and Loops
An Introduction to JavaScript
JavaScript CS 4640 Programming Languages for Web Applications
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript: Introduction to Scripting
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

CSS Colors, JavaScript Variables, Conditionals and Basic Methods © 2017, Akhilesh Bajaj. All rights reserved.

© 2017Akhilesh Bajaj, All rights reserved. Color Coding in CSS3 - Binary versus Decimal versus Hexadecimal Quantity: 2, 8, 9, 10, 11, 16, 17. -Binary Digit = bit, can represent 2 values One hexadecimal digit is represented using 4 bits, can represent 16 values RGB Scheme for colors: 2 hexadecimal digits or 8 bits each. How many total colors can we have? -Look up HTML5 color wheels. © 2017Akhilesh Bajaj, All rights reserved.

© 2017Akhilesh Bajaj, All rights reserved. ASCII versus Unicode ASCII code : 8 bits. How many characters can we represent? ASCII is old. Unicode is the current standard. Unicode: 16 bits. How many characters can we represent JavaScript Methods for printing the Unicode values of characters fromCharCode(i) charAt(i) © 2017Akhilesh Bajaj, All rights reserved.

ASCII versus Unicode -ASCII versus Unicode -Understand the difference between \u0041 and 65 as code representations for the letter ‘A’. In Class Assignment: Write a program that prints out the following table: Character Code A 65 Z --- a 97 z ---

A script element that embeds JavaScript in the head section Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

JavaScript in the body of an HTML document Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

A nonscript element in the body of an HTML document Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

How to split a statement over two or more lines Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

A JavaScript function with the identifiers highlighted Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Camel casing versus underscore notation Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

const Keyword in JavaScript const defines a constant that can be used throughout the code symbolically. If the value needs to be changed, it is only changed once. It also makes the code easier to read. E.g., const PI = 3.142; var circ, rad; rad = parseInt(prompt(“Enter radius”)); circ= 2*PI*rad; © 2018, Akhilesh Bajaj

A block of JavaScript code with the comments highlighted Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

© 2015, Mike Murach & Associates, Inc. How to code comments Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Common methods of the window object Do a for loop using confirm() method on w3 schools code. Murach's JavaScript (2nd Ed.), C2

A statement that calls the prompt method with the object named omitted Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Two methods of the window object for working with numbers Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Examples that use the parseInt and parseFloat methods Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

The same examples with the parse methods embedded in the alert method Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Other examples of parse methods Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

© 2015, Akhilesh Bajaj. All rights reserved. Fun In Class Assignment for if and for Write a javascript based program, called ComputeTotalSalary for our sales force. The program should have 1 html file, 1 css file and 1 js file. It should ask the user to input the name of the salesperson (String), the base salary and the total sales of last year (check they Are both numbers). If the sales are below zero, the program should print an error and exit. If the sales are between $1 and $25,000, the program should add a bonus of 5% of the sales to the base. If the sales are between $25,000 and $50,000, the program should add a bonus of 10% of sales. If the sales are between $50,000 and $100,000 it should add a bonus of 15% of sales. Sales over $100,000 merit a 20% of-sales bonus. Finally, the program should print the statement: The final salary of ----- is $XXXX.XX and ask the user if they want to run again. If the user says Yes or Y, it should run again, otherwise, it should say thanks and exit. © 2015, Akhilesh Bajaj. All rights reserved.

One property of the window object Fun Assignment: Write an HTML page with one button, labeled Search. When clicked, it opens a new window with your favorite search engine. Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Two methods of the document object Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

write() and writeIn() statements in the body Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Examples of number values Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

Common arithmetic operators Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

The order of precedence for arithmetic expressions Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

The most useful assignment operators Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

The concatenation operator for strings Escape sequences that can be used in strings Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

How to declare string variables and assign values to them Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

How to code compound assignment statements Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.

How escape sequences can be used in a string How to declare Boolean variables and assign values to them Murach's JavaScript (2nd Ed.), C2 © 2015, Mike Murach & Associates, Inc.