Lecture 4: Javascript Basics Javascript is a scripting language based on pieces of C, C++, shell scripts, Pascal, Java, etc. Scripts – loosely typed C++

Slides:



Advertisements
Similar presentations
Chapter 7 JavaScript: Introduction to Scripting. Outline Simple Programs Objects and Variables Obtaining User Input with prompt Dialogs – –Dynamic Welcome.
Advertisements

JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Intro to Javascript CS Client Side Scripting CS380 2.
Types of selection structures
A Level Computing#BristolMet Session Objectives#U2 S2 MUST describe the steps of an algorithm using a program flowchart SHOULD explain the data types and.
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
Java Script Session1 INTRODUCTION.
Javascript It’s not JAVA. What do these all have in common?
 2008 Pearson Education, Inc. All rights reserved JavaScript: Control Statements I.
Lesson 4: Formatting Input Data for Arithmetic
14/11/11.  These words have special meanings in themselves  These should NOT be used as Identifiers.  For example:  Break, do, function, case, else,
1 Javascrbipt Intro Javascript (or js) is a programming language. Interpreted, not compiled. Not the same as java, but, similar. Use tags to use. Object-oriented.
IST 221 Internet Concepts and Applications Introduction to PHP.
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.
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Information Technology Center Hany Abdelwahab Computer Specialist.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to scripting
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
Lecture 9 The Basics of JavaScript Boriana Koleva Room: C54
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
Javascript. What is JavaScript? Scripting (interpreted) language designed for the web Beware: JavaScript is case sensitive.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
1 JavaScript: Control Structures. 2 Control Structures Flowcharting JavaScript’s sequence structure.
Computer Science and Software Engineering© 2014 Project Lead The Way, Inc. HTML5 Evolving Standards JavaScript.
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 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
ECA 225 Applied Interactive Programming ECA 225 Applied Online Programming control structures, events, objects.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
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.
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.
Arrays and Loops. Learning Objectives By the end of this lecture, you should be able to: – Understand what a loop is – Appreciate the need for loops and.
Introduction to JavaScript academy.zariba.com 1. Lecture Content 1.What is JavaScript? 2.JavaScript Pros and Cons 3.The weird JavaScript stuff 4.Including.
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.
CSS Colors, JavaScript Variables, Conditionals and Basic Methods
CHAPTER 4 DECISIONS & LOOPS
>> Introduction to JavaScript
Chapter 6 JavaScript: Introduction to Scripting
Barb Ericson Georgia Institute of Technology May 2006
JavaScript Syntax and Semantics
Week#2 Day#1 Java Script Course
Chapter 19 JavaScript.
CSS Colors, JavaScript Variables, Conditionals and Basic Methods
WEB PROGRAMMING JavaScript.
T. Jumana Abu Shmais – AOU - Riyadh
Unit 6 part 3 Test Javascript Test.
An Introduction to JavaScript
2017, Fall Pusan National University Ki-Joune Li
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.
JavaScript: Introduction to Scripting
Introduction to JavaScript
Lecture 9: JavaScript Syntax
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

Lecture 4: Javascript Basics Javascript is a scripting language based on pieces of C, C++, shell scripts, Pascal, Java, etc. Scripts – loosely typed C++ - object oriented ideas Pascal – some syntax elements C – much program syntax and semantics Java – no pointers Check this example out…. ProgramProgram

Example source code testing javascript This is a Javascript example. It adds two numbers and then pr var i=1 ; while( i < ) i+=1; window.alert("Fatal system error. Restart your computer now?");

Javascript basics Declaring variables: var keyword, typeless variables Basic I/O:document.writeln( ); window.alert( ); window.prompt( ); Type conversion:parseInt( );

Another example testing1.html var number1, n1,n2, number2, sum; number1=window.prompt("enter number 1", "0"); number2=window.prompt("enter number 2", "0"); n1 = parseInt(number1); n2= parseInt(number2); sum = n1 + n2; document.writeln(" Sum is "+sum+" ");

Control structures Boolean expressions for loops while statements if then else switch statements

Another example testing1.html var n1,n2,counter=0,i, piest = 0, // quadrant =new Array(4); sum=0; counter=window.prompt("Enter the number of desired samples:","100"); counter=parseInt(counter); for (i=1 ; i<=counter ; ++i) { n1=(Math.random()-0.5)*2; n2=(Math.random()-0.5)*2; if ((n1*n1)+(n2*n2) < 1) piest +=1; }; sum=(4*piest/counter); document.writeln("The estimate of pi is "+sum);