SlideShare a Scribd company logo
Javascript 2 IF-Else / Switch / PopUp / Functions
IF - Else ,[object Object]
if...else statement- use this statement to   execute some code if the condition is true and another code if the condition is false
if...else if....else statement- use this statement to select one of many blocks of code to be executedif (time < 12)   { document.write("Goede Morgen");   } else   { document.write("Goede Middag");   }
IF - Else
IF - Else
Switch switch(n){case 1:  execute code block 1  break;case 2:  execute code block 2  break;default:  code to be executed if n is different from case 1 and 2}
Switch
Pop-Up Alert alert(“tekst");
Pop-Up Confirm
Pop-Up Prompt prompt(“text","defaultvalue");
Functions functionfunctionname(var1,var2,...,varX){some code} The parameters var1, var2, etc. are variables or values passed into the function. The { and the } defines the start and end of the function. Note: A function with no parameters must include the parentheses () after the function name. Note: Do not forget about the importance of capitals in JavaScript! The word function must be written in lowercase letters, otherwise a JavaScript error occurs! Also note that you must call a function with the exact same capitals as in the function name.
Functions Return
Functions Browserdetectie

More Related Content

What's hot

Java Decision Control
Java Decision ControlJava Decision Control
Java Decision Control
Jayfee Ramos
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
Saad Sheikh
 
Jslint 參數設定
Jslint 參數設定Jslint 參數設定
Jslint 參數設定
Kingsley Zheng
 
C++ STATEMENTS
C++ STATEMENTS C++ STATEMENTS
C++ STATEMENTS
Prof Ansari
 
Reading Keyboard Output
Reading Keyboard OutputReading Keyboard Output
Reading Keyboard Output
shaylor_swift
 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtp
Cuong Tran Van
 
1.4 core programming [understand error handling]
1.4 core programming [understand error handling]1.4 core programming [understand error handling]
1.4 core programming [understand error handling]tototo147
 
Control statement
Control statementControl statement
Control statement
Sakib Shahriar
 
Conditional statement c++
Conditional statement c++Conditional statement c++
Conditional statement c++
amber chaudary
 
Intorudction into VBScript
Intorudction into VBScriptIntorudction into VBScript
Intorudction into VBScriptVitaliy Ganzha
 
Java conditional statements
Java conditional statementsJava conditional statements
Java conditional statements
Kuppusamy P
 
Looping statements
Looping statementsLooping statements
Looping statements
Jaya Kumari
 
Ppt on java basics
Ppt on java basicsPpt on java basics
Ppt on java basics
Mavoori Soshmitha
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
VINOTH R
 
Loop and storage class
Loop and storage classLoop and storage class
Loop and storage classIsha Aggarwal
 
Decision statements
Decision statementsDecision statements
Decision statements
Jaya Kumari
 
Loop control statements
Loop control statementsLoop control statements
Loop control statements
Jaya Kumari
 
03loop conditional statements
03loop conditional statements03loop conditional statements
03loop conditional statements
Abdul Samad
 

What's hot (20)

Java Decision Control
Java Decision ControlJava Decision Control
Java Decision Control
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 
Jslint 參數設定
Jslint 參數設定Jslint 參數設定
Jslint 參數設定
 
C++ STATEMENTS
C++ STATEMENTS C++ STATEMENTS
C++ STATEMENTS
 
Reading Keyboard Output
Reading Keyboard OutputReading Keyboard Output
Reading Keyboard Output
 
Basic vbscript for qtp
Basic vbscript for qtpBasic vbscript for qtp
Basic vbscript for qtp
 
1.4 core programming [understand error handling]
1.4 core programming [understand error handling]1.4 core programming [understand error handling]
1.4 core programming [understand error handling]
 
Data structures vb
Data structures vbData structures vb
Data structures vb
 
Control statement
Control statementControl statement
Control statement
 
Conditional statement c++
Conditional statement c++Conditional statement c++
Conditional statement c++
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 
Intorudction into VBScript
Intorudction into VBScriptIntorudction into VBScript
Intorudction into VBScript
 
Java conditional statements
Java conditional statementsJava conditional statements
Java conditional statements
 
Looping statements
Looping statementsLooping statements
Looping statements
 
Ppt on java basics
Ppt on java basicsPpt on java basics
Ppt on java basics
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
 
Loop and storage class
Loop and storage classLoop and storage class
Loop and storage class
 
Decision statements
Decision statementsDecision statements
Decision statements
 
Loop control statements
Loop control statementsLoop control statements
Loop control statements
 
03loop conditional statements
03loop conditional statements03loop conditional statements
03loop conditional statements
 

Viewers also liked

Investment directions july 2012
Investment directions july 2012 Investment directions july 2012
Investment directions july 2012 Rankia
 
Les 1 php intro
Les 1 php introLes 1 php intro
Les 1 php intro
mvanginkel
 
Les 4 javascript
Les 4 javascriptLes 4 javascript
Les 4 javascriptmvanginkel
 
Les 2 Xml Css & Xslt
Les 2 Xml Css & XsltLes 2 Xml Css & Xslt
Les 2 Xml Css & Xsltmvanginkel
 
1.2 password beveiliging
1.2 password beveiliging1.2 password beveiliging
1.2 password beveiliging
mvanginkel
 
In search of yield market perspectives september 2012
In search of yield market perspectives september 2012In search of yield market perspectives september 2012
In search of yield market perspectives september 2012Rankia
 
Using social media for marketing your institution
Using social media for marketing your institutionUsing social media for marketing your institution
Using social media for marketing your institution
Anirudh Phadke
 
Land and Light
Land and LightLand and Light
Land and Light
Alan Doherty
 
Your browser can see and hear and ...
Your browser can see and hear and ...Your browser can see and hear and ...
Your browser can see and hear and ...
Rob Manson
 
Les 3 Javascript
Les 3 JavascriptLes 3 Javascript
Les 3 Javascriptmvanginkel
 
The Open Web approach
The Open Web approachThe Open Web approach
The Open Web approach
Tristan Nitot
 
Finding fault in Hollister, California
Finding fault in Hollister, CaliforniaFinding fault in Hollister, California
Finding fault in Hollister, California
Alan Doherty
 
1.1 cms inlogscherm
1.1 cms inlogscherm1.1 cms inlogscherm
1.1 cms inlogscherm
mvanginkel
 
Html les 2.5_animation
Html les 2.5_animationHtml les 2.5_animation
Html les 2.5_animation
mvanginkel
 
3.1 workshop website plannen_met_mindmap
3.1 workshop website plannen_met_mindmap3.1 workshop website plannen_met_mindmap
3.1 workshop website plannen_met_mindmap
mvanginkel
 
1.5 list style
1.5 list style1.5 list style
1.5 list style
mvanginkel
 

Viewers also liked (20)

Investment directions july 2012
Investment directions july 2012 Investment directions july 2012
Investment directions july 2012
 
Les 1 php intro
Les 1 php introLes 1 php intro
Les 1 php intro
 
Les 4 javascript
Les 4 javascriptLes 4 javascript
Les 4 javascript
 
Les 4 php w2
Les 4 php w2Les 4 php w2
Les 4 php w2
 
Les 2 Xml Css & Xslt
Les 2 Xml Css & XsltLes 2 Xml Css & Xslt
Les 2 Xml Css & Xslt
 
Les 3 html
Les 3 htmlLes 3 html
Les 3 html
 
to ky
to kyto ky
to ky
 
Wdreader1
Wdreader1Wdreader1
Wdreader1
 
1.2 password beveiliging
1.2 password beveiliging1.2 password beveiliging
1.2 password beveiliging
 
In search of yield market perspectives september 2012
In search of yield market perspectives september 2012In search of yield market perspectives september 2012
In search of yield market perspectives september 2012
 
Using social media for marketing your institution
Using social media for marketing your institutionUsing social media for marketing your institution
Using social media for marketing your institution
 
Land and Light
Land and LightLand and Light
Land and Light
 
Your browser can see and hear and ...
Your browser can see and hear and ...Your browser can see and hear and ...
Your browser can see and hear and ...
 
Les 3 Javascript
Les 3 JavascriptLes 3 Javascript
Les 3 Javascript
 
The Open Web approach
The Open Web approachThe Open Web approach
The Open Web approach
 
Finding fault in Hollister, California
Finding fault in Hollister, CaliforniaFinding fault in Hollister, California
Finding fault in Hollister, California
 
1.1 cms inlogscherm
1.1 cms inlogscherm1.1 cms inlogscherm
1.1 cms inlogscherm
 
Html les 2.5_animation
Html les 2.5_animationHtml les 2.5_animation
Html les 2.5_animation
 
3.1 workshop website plannen_met_mindmap
3.1 workshop website plannen_met_mindmap3.1 workshop website plannen_met_mindmap
3.1 workshop website plannen_met_mindmap
 
1.5 list style
1.5 list style1.5 list style
1.5 list style
 

Similar to Les 2 Javascript

2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
ManojKhadilkar1
 
javascript conditional-statements
 javascript conditional-statements javascript conditional-statements
javascript conditional-statementsbhooth
 
javascript conditional-statements
 javascript conditional-statements javascript conditional-statements
javascript conditional-statements
bhooth1
 
Java Control Statements
Java Control StatementsJava Control Statements
Java Control Statements
KadarkaraiSelvam
 
C statements
C statementsC statements
C statements
Ahsann111
 
Switch statement, break statement, go to statement
Switch statement, break statement, go to statementSwitch statement, break statement, go to statement
Switch statement, break statement, go to statement
Raj Parekh
 
JAVA SWITCH STATEMENT
JAVA SWITCH STATEMENTJAVA SWITCH STATEMENT
JAVA SWITCH STATEMENT
Rhythm Suiwal
 
Unit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment exampleUnit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment example
umaghosal12101974
 
Chapter 8 - Conditional Statement
Chapter 8 - Conditional StatementChapter 8 - Conditional Statement
Chapter 8 - Conditional StatementDeepak Singh
 
Bansal presentation (1).pptx
Bansal presentation (1).pptxBansal presentation (1).pptx
Bansal presentation (1).pptx
AbhiYadav655132
 
Janakiram web
Janakiram webJanakiram web
Janakiram web
MARELLA CHINABABU
 
Control Structure in JavaScript (1).pptx
Control Structure in JavaScript (1).pptxControl Structure in JavaScript (1).pptx
Control Structure in JavaScript (1).pptx
BansalShrivastava
 
Control Statement programming
Control Statement programmingControl Statement programming
Control Statement programming
University of Potsdam
 
Chapter 4(1)
Chapter 4(1)Chapter 4(1)
Chapter 4(1)
TejaswiB4
 
Flow Control (C#)
Flow Control (C#)Flow Control (C#)
Flow Control (C#)
Bhushan Mulmule
 
Looping statement
Looping statementLooping statement
Looping statementilakkiya
 
Javascript
JavascriptJavascript
Javascript
Gita Kriz
 
Simple if else statement,nesting of if else statement &amp; else if ladder
Simple if else statement,nesting of if else statement &amp; else if ladderSimple if else statement,nesting of if else statement &amp; else if ladder
Simple if else statement,nesting of if else statement &amp; else if ladder
Moni Adhikary
 
lecture 6 bca 1 year-1.pptx
lecture 6 bca 1 year-1.pptxlecture 6 bca 1 year-1.pptx
lecture 6 bca 1 year-1.pptx
classall
 

Similar to Les 2 Javascript (20)

2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
 
javascript conditional-statements
 javascript conditional-statements javascript conditional-statements
javascript conditional-statements
 
javascript conditional-statements
 javascript conditional-statements javascript conditional-statements
javascript conditional-statements
 
Java Control Statements
Java Control StatementsJava Control Statements
Java Control Statements
 
C statements
C statementsC statements
C statements
 
Switch statement, break statement, go to statement
Switch statement, break statement, go to statementSwitch statement, break statement, go to statement
Switch statement, break statement, go to statement
 
JAVA SWITCH STATEMENT
JAVA SWITCH STATEMENTJAVA SWITCH STATEMENT
JAVA SWITCH STATEMENT
 
Unit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment exampleUnit_3A_If_Else_Switch and a if else statment example
Unit_3A_If_Else_Switch and a if else statment example
 
Chapter 8 - Conditional Statement
Chapter 8 - Conditional StatementChapter 8 - Conditional Statement
Chapter 8 - Conditional Statement
 
Bansal presentation (1).pptx
Bansal presentation (1).pptxBansal presentation (1).pptx
Bansal presentation (1).pptx
 
Janakiram web
Janakiram webJanakiram web
Janakiram web
 
Control Structure in JavaScript (1).pptx
Control Structure in JavaScript (1).pptxControl Structure in JavaScript (1).pptx
Control Structure in JavaScript (1).pptx
 
Control Statement programming
Control Statement programmingControl Statement programming
Control Statement programming
 
Chapter 4(1)
Chapter 4(1)Chapter 4(1)
Chapter 4(1)
 
Flow Control (C#)
Flow Control (C#)Flow Control (C#)
Flow Control (C#)
 
Looping statement
Looping statementLooping statement
Looping statement
 
Javascript
JavascriptJavascript
Javascript
 
csc ppt 15.pptx
csc ppt 15.pptxcsc ppt 15.pptx
csc ppt 15.pptx
 
Simple if else statement,nesting of if else statement &amp; else if ladder
Simple if else statement,nesting of if else statement &amp; else if ladderSimple if else statement,nesting of if else statement &amp; else if ladder
Simple if else statement,nesting of if else statement &amp; else if ladder
 
lecture 6 bca 1 year-1.pptx
lecture 6 bca 1 year-1.pptxlecture 6 bca 1 year-1.pptx
lecture 6 bca 1 year-1.pptx
 

Les 2 Javascript