JavaScript Javascript is a scripting language produced by Netscape for use within HTML Web pages. JavaScript is loosely based on Java and it is built into.

Slides:



Advertisements
Similar presentations
Java Script Session1 INTRODUCTION.
Advertisements

Chapter 41 Variables and JSP Control Structures JavaServer Pages By Xue Bai.
14/11/11.  These words have special meanings in themselves  These should NOT be used as Identifiers.  For example:  Break, do, function, case, else,
True or false A variable of type char can hold the value 301. ( F )
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.
Logical Operators Java provides two binary logical operators (&& and ||) that are used to combine boolean expressions. Java also provides one unary (!)
Loops – While, Do, For Repetition Statements Introduction to Arrays
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
Conditional Statements While writing a program, there may be a situation when you need to adopt one path out of the given two paths. So you need to make.
Week 9 PHP Cookies and Session Introduction to JavaScript.
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.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
 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,
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
LOGO Conditional Statements & Loops in JavaScript CHAPTER 10 Eastern Mediterranean University School of Computing and Technology Department of Information.
L OO P S While writing a program, there may be a situation when you need to perform some action over and over again. In such situation you would need.
1 JavaScript
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
 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.
JavaScript, Fourth Edition
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
COMP403 Web Design JAVA SCRİPTS Tolgay KARANFİLLER.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Pertemuan 5 IT133 Pengembangan Web JavaScript. What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
JavaScript, Sixth Edition
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
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.
JavaScript Tutorial First lecture 19/2/2016. Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part.
Java Script Introduction. Java Script Introduction.
>> Introduction to JavaScript
JavaScript Tutorial Second lecture 22/2/2016.
Chapter 6 JavaScript: Introduction to Scripting
JavaScript Syntax and Semantics
Expressions and Control Flow in JavaScript
JavaScript.
JavaScript: Control Statements.
CHAPTER 4 CLIENT SIDE SCRIPTING PART 2 OF 3
WEB PROGRAMMING JavaScript.
PHP.
T. Jumana Abu Shmais – AOU - Riyadh
CS105 Introduction to Computer Concepts
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Tutorial 10: Programming with javascript
JavaScript: Introduction to Scripting
Web Programming– UFCFB Lecture 13
CIS 136 Building Mobile Apps
Web Programming and Design
CS105 Introduction to Computer Concepts JavaScript
Presentation transcript:

JavaScript Javascript is a scripting language produced by Netscape for use within HTML Web pages. JavaScript is loosely based on Java and it is built into all the major modern browsers. JavaScript started life as LiveScript, but Netscape changed the name, possibly because of the excitement being generated by Java.to JavaScript. JavaScript made its first appearance in Netscape 2.0 in 1995 with a name LiveScript. JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages.

JavaScript Syntax A JavaScript consists of JavaScript statements that are placed within the... HTML tags in a web page. You can place the tag containing your JavaScript anywhere within you web page but it is preferred way to keep it within the tags. The tag alert the browser program to begin interpreting all the text between these tags as a script. JavaScript code

The script tag takes two important attributes: language: This attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute. type: This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript". JavaScript code

<!-- document.write("Hello World!") //--> <!-- document.write("Hello World") //--> This is web page body

JavaScript in External File

JavaScript DataTypes: JavaScript allows you to work with three primitive data types: Numbers eg. 123, etc. Strings of text e.g. "This text string" etc. Boolean e.g. true or false. JavaScript Variables: <!-- var money; var name; //--> <!-- var money, name; //-->

JavaScript Variable Names: While naming your variables in JavaScript keep following rules in mind. You should not use any of the JavaScript reserved keyword as variable name. These keywords are mentioned in the next section. For example, break or boolean variable names are not valid. JavaScript variable names should not start with a numeral (0-9). They must begin with a letter or the underscore character. For example, 123test is an invalid variable name but_123test is a valid one. JavaScript variable names are case sensitive. For example, Name and name are two different variables. See reserve words at Bayanihan Campus

var money; var name; money = ; name = "Ali"; document.write(money); document.write(" "); document.write(name); Set the variables to different values and then try...

JavaScript Operators What is an operator? Simple answer can be given using expression is equal to 9. Here 4 and 5 are called operands and + is called operator. JavaScript language supports following type of operators. Arithmetic Operators Comparision Operators Logical (or Relational) Operators Assignment Operators Conditional (or ternary) Operators

JavaScript Arithmetic Operators +Addition -Subtraction *Multiplication /Division %Modulus ++Increment --Decrement JavaScript Assignment Operators =x = yx = y +=x += yx = x + y -=x -= yx = x - y *=x *= yx = x * y /=x /= yx = x / y %=x %= yx = x % y JavaScript String Operators txt1 = "John"; txt2 = "Doe"; txt3 = txt1 + " " + txt2; Adding Strings and Numbers x = 5 + 5; y = "5" + 5; z= "Hello" + 5; JavaScript Comparison and Logical Operators ==equal to ===equal value and equal type !=not equal !==not equal value or not equal type >greater than <less than >=greater than or equal to <=less than or equal to

Conditional statements are used to perform different actions based on different conditions. Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. In JavaScript we have the following conditional statements: Use if to specify a block of code to be executed, if a specified condition is true Use else to specify a block of code to be executed, if the same condition is false Use else if to specify a new condition to test, if the first condition is false Use switch to specify many alternative blocks of code to be executed Conditional Statements

if (expression){ Statement(s) to be executed if expression is true } <!-- var age = 20; if( age > 18 ){ document.write(" Qualifies for driving "); } //--> if statement: The if statement is the fundamental control statement that allows JavaScript to make decisions and execute statements conditionally.

if...else statement: The if...else statement is the next form of control statement that allows JavaScript to execute statements in more controlled way. if (expression){ Statement(s) to be executed if expression is true }else{ Statement(s) to be executed if expression is false } <!-- var age = 15; if( age > 18 ){ document.write(" Qualifies for driving "); }else{ document.write(" Does not qualify for driving "); } //-->

if...else if... statement: The if...else if... statement is the one level advance form of control statement that allows JavaScript to make correct decision out of several conditions. if (expression 1){ Statement(s) to be executed if expression 1 is true }else if (expression 2){ Statement(s) to be executed if expression 2 is true }else if (expression 3){ Statement(s) to be executed if expression 3 is true }else{ Statement(s) to be executed if no expression is true } <!-- var book = "maths"; if( book == "history" ){ document.write(" History Book "); }else if( book == "maths" ){ document.write(" Maths Book "); }else if( book == "economics" ){ document.write(" Economics Book "); }else{ document.write(" Unknown Book "); } //-->

JavaScript Switch Case Syntax: The basic syntax of the switch statement is to give an expression to evaluate and several different statements to execute based on the value of the expression. The interpreter checks each case against the value of the expression until a match is found. If nothing matches, adefault condition will be used. switch (expression) { case condition 1: statement(s) break; case condition 2: statement(s) break;... case condition n: statement(s) break; default: statement(s) }

<!— var grade='A'; document.write("Entering switch block ") ;switch (grade){ case 'A': document.write("Good job "); case 'B': document.write("Pretty good "); case 'C': document.write("Passed "); case 'D': document.write("Not so good "); case 'F': document.write("Failed "); default: document.write("Unknown grade ") } document.write("Exiting switch block"); //-->

JavaScript while Loops While writing a program, there may be a situation when you need to perform some action over and over again. In such situation you would need to write loop statements to reduce the number of lines. The while Loop while (expression){ Statement(s) to be executed if expression is true } <!-- var count = 0; document.write("Starting Loop" + " "); while (count < 10){ document.write("Current Count : " + count + " "); count++; } document.write("Loop stopped!"); //-->

The do...while Loop: The do...while loop is similar to the while loop except that the condition check happens at the end of the loop. This means that the loop will always be executed at least once, even if the condition is false. Syntax: do{ Statement(s) to be executed; } while (expression); <!-- var count = 0; document.write("Starting Loop" + " "); do{ document.write("Current Count : " + count + " "); count++; }while (count < 0); document.write("Loop stopped!"); //-->

JavaScript for Loops The for Loop The for loop is the most compact form of looping and includes the following three important parts: The loop initialization where we initialize our counter to a starting value. The initialization statement is executed before the loop begins. The test statement which will test if the given condition is true or not. If condition is true then code given inside the loop will be executed otherwise loop will come out. The iteration statement where you can increase or decrease your counter. for (initialization; test condition; iteration statement){ Statement(s) to be executed if test condition is true }

<!-- var count; document.write("Starting Loop" + " "); for(count = 0; count < 10; count++){ document.write("Current Count : " + count ); document.write(" "); } document.write("Loop stopped!"); //-->

The break Statement: <!-- var x = 1; document.write("Entering the loop "); while (x < 20) { if (x == 5){ break; // breaks out of loop completely } x = x + 1; document.write( x + " "); } document.write("Exiting the loop! "); //-->

<!-- function over() { alert("Mouse Over"); } function out() { alert("Mouse Out"); } //--> Bring your mouse inside the division to see the result: This is inside the division onmouseover and onmouseout:

<!-- function Redirect() { window.location=" } //--> Click the following button, you will be redirected to home page. Page Re-direction

<!-- function Redirect() { window.location=" } document.write("You will be redirected to our main page in 10 seconds!"); setTimeout('Redirect()', 10000); //-->

<!-- var browsername=navigator.appName; if( browsername == "Netscape" ) { window.location=" } else if ( browsername =="Microsoft Internet Explorer") { window.location=" } else { window.location=" } //-->

<!-- function getConfirmation(){ var retVal = confirm("Do you want to continue ?"); if( retVal == true ){ alert("User wants to continue!"); return true; }else{ alert("User does not want to continue!"); return false; } //--> Click the following button to see the result:

<!-- function getValue(){ var retVal = prompt("Enter your name : ", "your name here"); alert("You have entered : " + retVal ); } //--> Click the following button to see the result:

Javascript - The Arrays Object The Array object let's you store multiple values in a single variable. Syntax: Creating a Array object: var fruits = new Array( "apple", "orange", "mango" ); The Array parameter is a list of strings or integers. When you specify a single numeric parameter with the Array constructor, you specify the initial length of the array. The maximum length allowed for an array is 4,294,967,295. You can create array by simply assigning values as follows: var fruits = [ "apple", "orange", "mango" ]; You will use ordinal numbers to access and to set values inside an array as follows: fruits[0] is the first element fruits[1] is the second element fruits[2] is the third element

User-defined objects function book(title, author){ this.title = title; this.author = author; } var myBook = new book("Perl", "Mohtashim"); myBook.price = 50; document.write("Book title is : " + myBook.title + " "); document.write("Book author is : " + myBook.author + " "); document.write("Book price is : " + myBook.price + " ");

Objective: 100% of the people will be able to motivate and learn ideas Process: Greet Smile Visualize Share Ideas Let Them Talk Activities Evaluate Assignment

Objective: 100% of the people will be able to motivate and learn ideas Process: Greet Smile Visualize Share Ideas Let Them Talk Activities Evaluate Assignment

Objective: 100% of the people will be able to motivate and learn ideas Process: Greet Smile Visualize Share Ideas Let Them Talk Activities Evaluate Assignment

File Name: Joenard Pedro Keywords: nardpedro Type: Teacher Date Created: May Created By: Bathala Location: Dreamland Taguig Attributes: Read-only Connection: Dimensions: H.5ft5.7in~167cm W.127.6lb~57.9kg

Objective: 100% of the people will be able to motivate and learn ideas Process: Greet Smile Visualize Share Ideas Let Them Talk Activities Evaluate Assignment

Requirements: Participation30% max50points Quiz20% max20points Assignment10% max20points Major exam40% max50points

Program: Term 1 {June 17} Process: Evaluate Current Potential Transfer Information Test.. Modify.. Update.. Final Deployment Record On-going Potential

Participation Requirements: Attendance 10hrs max excuse Notebook +2points early Room Maintained 10points Recitation +2points Extra points from AQE

Room Maintenance: early birds +2point enrolled student are allowed to enter the room. maintain proper sitting arrangement. +1point eating and drinking are allowed in canteen. devices should be inside the bag. +1point bags and things should stay in one place. +1point raise hand and wait to be called. +1point one person talks at a time. 3step between prof and student. clean and arrange own space. +3point finish every seconds of the class. +1point “Following instincts, true wisdom manifests.” fb.com/aklatnipedro

Routine: 15mins Preparation 15mins Checking 30mins to Write Discussion Quiz

Add-ons: o FBgroup to be announce at { o Cloud { o Test is above requirements. o Present student when instructor is excused +10points o 1/8 letter/question/greetings/suggestion/comment

Start-up: First to accomplish +20points 1/8 index card.. Write back to back.. //sample. name: Your, Complete N. contact: ||Mobile student#: 5TUD3NT-NUM83R course/subj.: ADHD/Ethical Hacking schedule/rm.: MWF 3am-5am/rm. attendance: |J14|J15|J16|J17|J18|J19|J20| | | | | | | | | |J21|J22|J23|J24|J25|J26|J27| | | | | | | | | |J28|J29|J30|J31|F01|J02|J03| | | | | | | | | |J04|J05|J06|J07|J08|J09|J10| | | | | | | | |

::: credits ::: Bathala Bayanihan Campus {ƒacebook}