SlideShare a Scribd company logo
Java Script
Content
 Introduction
 What is Java Script?
 How does it works?
 JavaScript Variables
 JavaScript Operator
 JavaScript Popup Boxes
 HTML Form and JavaScript
 Are Java and JavaScript the same?
Introduction
 JavaScript is used in millions of Web pages to
improve the design, validate forms, detect browsers,
create cookies, and much more.
 JavaScript is the most popular scripting language on
the internet, and works in all major browsers, such as
Internet Explorer, Mozilla, Firefox, Netscape, Opera.
What is JavaScript?
 JavaScript was designed to add interactivity to HTML pages
 JavaScript is a scripting language (a scripting language is a
lightweight programming language)
 A JavaScript consists of lines of executable computer code
 A JavaScript is usually embedded directly into HTML pages
 JavaScript is an interpreted language (means that scripts
execute without preliminary compilation)
 Everyone can use JavaScript without purchasing a license
How does it Work?
 Embedded within HTML page
View source
 Executes on client
Fast, no connection needed once loaded
 Simple programming statements combined with HTML tags
 Interpreted (not compiled)
 No special tools required
JavaScript Variables
 Variables are used to store data.
 A variable is a "container" for information you want to store.
A variable's value can change during the script. You can refer
to a variable by name to see its value or to change its value.
 Rules for variable names:
Variable names are case sensitive
They must begin with a letter or the underscore character
strname – STRNAME (not same)
JavaScript Operator
 There are Various type of operator
1) Arithmetic Operator
2) Assignment Operator
3) Comparison Operator
4) Logical Operator
JavaScript Operator
 Arithmetic Operator :-
Operator Description Example Result
+ Addition x=2 4
y=2
x+y
- Subtraction x=5 3
y=2
x-y
* Multiplication x=5 20
y=4
x*y
/ Division 15/5 3
5/2 2,5
% Modulus (division
remainder)
5%2 1
10%8 2
10%2 0
++ Increment x=5 x=6
x++
-- Decrement x=5 x=4
x--
JavaScript Operator
 Assignment Operator :-
Operator Example Is The Same As
= x=y x=y
+= x+=y x=x+y
-= x-=y x=x-y
*= x*=y x=x*y
/= x/=y x=x/y
%= x%=y x=x%y
JavaScript Operator
 Comparison Operator :-
Operator Description Example
== is equal to 5==8 returns false
=== is equal to (checks for both
value and type)
x=5
y="5"
x==y returns true
x===y returns false
!= is not equal 5!=8 returns true
> is greater than 5>8 returns false
< is less than 5<8 returns true
>= is greater than or equal to 5>=8 returns false
<= is less than or equal to 5<=8 returns true
JavaScript Operator
 Logical Operator :-
Operator Description Example
&& and x=6
y=3
(x < 10 && y > 1)
returns true
|| or x=6
y=3
(x==5 || y==5)
returns false
! not x=6
y=3
!(x==y) returns
true
JavaScript Popup Boxes
 Alert Box
An alert box is often used if you want to make sure
information comes through to the user.
When an alert box pops up, the user will have to click
"OK" to proceed.
<script>
alert("Hello World!")
</script>
JavaScript Popup Boxes
 Confirm Box
A confirm box is often used if you want the user to verify
or accept something.
When a confirm box pops up, the user will have to click
either "OK" or "Cancel" to proceed.
If the user clicks "OK", the box returns true. If the user
clicks "Cancel", the box returns false.
JavaScript Popup Boxes
 Prompt Box
 A prompt box is often used if you want the user to input a value before entering
a page.
 When a prompt box pops up, the user will have to click either "OK" or "Cancel"
to proceed after entering an input value.
 If the user clicks "OK“, the box returns the input value. If the user clicks
"Cancel“, the box returns null.
<script>
x=prompt (“Adınızı Yazınız”, “ ”)
document.write(“Merhaba <br>”,+x)
</script>
HTML Form and JavaScript
<form name="addressform">
Name: <input name="yourname"><br />
Phone: <input name="phone"><br />
Email: <input name="email"><br />
</form>
HTML Form and JavaScript
document.formname.elementname.value
Thus:
document.addressform.yourname.value
document.addressform.phone.value
document.addressform.email.value
Are Java and JavaScript the same?
 NO!
 Java and JavaScript are two completely different
languages in both concept and design!
 Java (developed by Sun Microsystems) is a powerful
and much more complex programming language - in
the same category as C and C++.
 JavaScript is the Scripting Language.

More Related Content

What's hot

Message Box in JS
Message Box in JSMessage Box in JS
Message Box in JS
paranormal2013
 
Java Script
Java ScriptJava Script
Java Script
husbancom
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
Maitree Patel
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
Rajiv Gupta
 
Java script basic
Java script basicJava script basic
Java script basic
Ravi Bhadauria
 
PHP Form Validation Technique
PHP Form Validation TechniquePHP Form Validation Technique
PHP Form Validation Technique
Morshedul Arefin
 
HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4
Sanjeev Kumar
 
Java scripts
Java scriptsJava scripts
Java scripts
Capgemini India
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
DivyaKS12
 
Less css framework
Less css frameworkLess css framework
Less css framework
Manisha Bano
 
Java script
Java scriptJava script
Java script
Rajkiran Mummadi
 
Basics java scripts
Basics java scriptsBasics java scripts
Basics java scriptsch samaram
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
nanjil1984
 
HTML 5 Simple Tutorial Part 3
HTML 5 Simple Tutorial Part 3HTML 5 Simple Tutorial Part 3
HTML 5 Simple Tutorial Part 3
Sanjeev Kumar
 
Making web forms using php
Making web forms using phpMaking web forms using php
Making web forms using php
krishnapriya Tadepalli
 
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteMVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
Ravi Bhadauria
 
Html 5 Forms
Html 5 FormsHtml 5 Forms
Html 5 Forms
Jim Gerland
 
Java script form validation
Java script  form validationJava script  form validation
Java script form validation
AbhishekMondal42
 
Java script
Java scriptJava script
Java script
Sadeek Mohammed
 

What's hot (20)

Message Box in JS
Message Box in JSMessage Box in JS
Message Box in JS
 
Java Script
Java ScriptJava Script
Java Script
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
 
1. java script language fundamentals
1. java script language fundamentals1. java script language fundamentals
1. java script language fundamentals
 
Java script basic
Java script basicJava script basic
Java script basic
 
PHP Form Validation Technique
PHP Form Validation TechniquePHP Form Validation Technique
PHP Form Validation Technique
 
Why study java script
Why study java scriptWhy study java script
Why study java script
 
HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4
 
Java scripts
Java scriptsJava scripts
Java scripts
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
Less css framework
Less css frameworkLess css framework
Less css framework
 
Java script
Java scriptJava script
Java script
 
Basics java scripts
Basics java scriptsBasics java scripts
Basics java scripts
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
HTML 5 Simple Tutorial Part 3
HTML 5 Simple Tutorial Part 3HTML 5 Simple Tutorial Part 3
HTML 5 Simple Tutorial Part 3
 
Making web forms using php
Making web forms using phpMaking web forms using php
Making web forms using php
 
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia InstituteMVC Design Pattern in JavaScript by ADMEC Multimedia Institute
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
 
Html 5 Forms
Html 5 FormsHtml 5 Forms
Html 5 Forms
 
Java script form validation
Java script  form validationJava script  form validation
Java script form validation
 
Java script
Java scriptJava script
Java script
 

Similar to Javascript

Active browser web page
Active browser web pageActive browser web page
Active browser web page
Zee1481
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
MadhurRajVerma1
 
Web designing unit 4
Web designing unit 4Web designing unit 4
Web designing unit 4
SURBHI SAROHA
 
Java script.pptx v
Java script.pptx                                     vJava script.pptx                                     v
Java script.pptx v
22x026
 
Javascript
JavascriptJavascript
Javascript
Nagarajan
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
Mohammed Hussein
 
Java script
Java scriptJava script
Java script
Sanjay Gunjal
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)SANTOSH RATH
 
Java scipt
Java sciptJava scipt
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoftch samaram
 
Basics of Javascript
Basics of Javascript Basics of Javascript
Basics of Javascript
poojanov04
 
Java script
Java scriptJava script
Java script
shamim hasan
 
Javascript
JavascriptJavascript
Javascript
D V BHASKAR REDDY
 
Web programming
Web programmingWeb programming
Web programming
Leo Mark Villar
 
1472251766_demojavascriptppt (1).ppt
1472251766_demojavascriptppt (1).ppt1472251766_demojavascriptppt (1).ppt
1472251766_demojavascriptppt (1).ppt
ictlab3
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
teach4uin
 
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and ScriptingIT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
pkaviya
 

Similar to Javascript (20)

Active browser web page
Active browser web pageActive browser web page
Active browser web page
 
UNIT 3.ppt
UNIT 3.pptUNIT 3.ppt
UNIT 3.ppt
 
Unit 2.4
Unit 2.4Unit 2.4
Unit 2.4
 
Web designing unit 4
Web designing unit 4Web designing unit 4
Web designing unit 4
 
Unit 2.4
Unit 2.4Unit 2.4
Unit 2.4
 
Java script.pptx v
Java script.pptx                                     vJava script.pptx                                     v
Java script.pptx v
 
Javascript
JavascriptJavascript
Javascript
 
JAVA SCRIPT
JAVA SCRIPTJAVA SCRIPT
JAVA SCRIPT
 
Java script
Java scriptJava script
Java script
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)
 
Java scipt
Java sciptJava scipt
Java scipt
 
Javascript sivasoft
Javascript sivasoftJavascript sivasoft
Javascript sivasoft
 
Basics of Javascript
Basics of Javascript Basics of Javascript
Basics of Javascript
 
Java script
Java scriptJava script
Java script
 
Javascript
JavascriptJavascript
Javascript
 
Web programming
Web programmingWeb programming
Web programming
 
1472251766_demojavascriptppt (1).ppt
1472251766_demojavascriptppt (1).ppt1472251766_demojavascriptppt (1).ppt
1472251766_demojavascriptppt (1).ppt
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and ScriptingIT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
 
Google maps
Google mapsGoogle maps
Google maps
 

Recently uploaded

AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 

Recently uploaded (20)

AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 

Javascript

  • 2. Content  Introduction  What is Java Script?  How does it works?  JavaScript Variables  JavaScript Operator  JavaScript Popup Boxes  HTML Form and JavaScript  Are Java and JavaScript the same?
  • 3. Introduction  JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more.  JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Mozilla, Firefox, Netscape, Opera.
  • 4. What is JavaScript?  JavaScript was designed to add interactivity to HTML pages  JavaScript is a scripting language (a scripting language is a lightweight programming language)  A JavaScript consists of lines of executable computer code  A JavaScript is usually embedded directly into HTML pages  JavaScript is an interpreted language (means that scripts execute without preliminary compilation)  Everyone can use JavaScript without purchasing a license
  • 5. How does it Work?  Embedded within HTML page View source  Executes on client Fast, no connection needed once loaded  Simple programming statements combined with HTML tags  Interpreted (not compiled)  No special tools required
  • 6. JavaScript Variables  Variables are used to store data.  A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value.  Rules for variable names: Variable names are case sensitive They must begin with a letter or the underscore character strname – STRNAME (not same)
  • 7. JavaScript Operator  There are Various type of operator 1) Arithmetic Operator 2) Assignment Operator 3) Comparison Operator 4) Logical Operator
  • 8. JavaScript Operator  Arithmetic Operator :- Operator Description Example Result + Addition x=2 4 y=2 x+y - Subtraction x=5 3 y=2 x-y * Multiplication x=5 20 y=4 x*y / Division 15/5 3 5/2 2,5 % Modulus (division remainder) 5%2 1 10%8 2 10%2 0 ++ Increment x=5 x=6 x++ -- Decrement x=5 x=4 x--
  • 9. JavaScript Operator  Assignment Operator :- Operator Example Is The Same As = x=y x=y += x+=y x=x+y -= x-=y x=x-y *= x*=y x=x*y /= x/=y x=x/y %= x%=y x=x%y
  • 10. JavaScript Operator  Comparison Operator :- Operator Description Example == is equal to 5==8 returns false === is equal to (checks for both value and type) x=5 y="5" x==y returns true x===y returns false != is not equal 5!=8 returns true > is greater than 5>8 returns false < is less than 5<8 returns true >= is greater than or equal to 5>=8 returns false <= is less than or equal to 5<=8 returns true
  • 11. JavaScript Operator  Logical Operator :- Operator Description Example && and x=6 y=3 (x < 10 && y > 1) returns true || or x=6 y=3 (x==5 || y==5) returns false ! not x=6 y=3 !(x==y) returns true
  • 12. JavaScript Popup Boxes  Alert Box An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click "OK" to proceed. <script> alert("Hello World!") </script>
  • 13. JavaScript Popup Boxes  Confirm Box A confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false.
  • 14. JavaScript Popup Boxes  Prompt Box  A prompt box is often used if you want the user to input a value before entering a page.  When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value.  If the user clicks "OK“, the box returns the input value. If the user clicks "Cancel“, the box returns null. <script> x=prompt (“Adınızı Yazınız”, “ ”) document.write(“Merhaba <br>”,+x) </script>
  • 15. HTML Form and JavaScript <form name="addressform"> Name: <input name="yourname"><br /> Phone: <input name="phone"><br /> Email: <input name="email"><br /> </form>
  • 16. HTML Form and JavaScript document.formname.elementname.value Thus: document.addressform.yourname.value document.addressform.phone.value document.addressform.email.value
  • 17. Are Java and JavaScript the same?  NO!  Java and JavaScript are two completely different languages in both concept and design!  Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++.  JavaScript is the Scripting Language.