SlideShare a Scribd company logo
Introduction to JavaSctipt Introduction to JavaScript by Sabyasachi Ghosh http://neilghosh.com
A Programming Language A client side scripting langugage Downloaded as is from server  Can be generated using server side scripting Nothing to do with Java No Compilation required Most of the browsers support it Its free !
How Does it look like <html> <body> <h1>My First Web Page</h1> <script type=&quot;text/javascript&quot;> document.write(&quot;<p>&quot; + Date() + &quot;</p>&quot;); </script> </body> </html>
Printing and Variables document.write(&quot;Hello World ! &quot;); var x; var x= 10; var name = “Neil”; = is used to assign values. + is used to add/concat values.
Conditional and Looping Similar to C and and JAVA If(condition){..} else{..} switch .. case .. for(i=1;i<10;i++){..} while(i<10){} for(i in X){ .. X[i] .. }  /where  var X  =  {x:10,y:20}
Pop-Ups alert(&quot;I am an alert box!&quot;); var r=confirm(&quot;Press a button&quot;); var name=prompt(&quot;Please enter your name&quot;,&quot;Harry Potter&quot;);
Functions and Events Defination function add(x,y){  return  x +y ; } Call  var z= (x,y); <input type=&quot;button&quot; value=&quot;Click me!&quot;    onclick=&quot;myFunc()&quot; /> Similarly onLoad,onUnload,onFocus, onBlur, onChange,onSubmit,onMouseOver
JavaScript Objects String length(),toUpperCase() Date var today = new Date() , setDate Array var myCars=new Array();  myCars[0] Boolean Custom var person={fname:&quot;John&quot;,lname:&quot;Doe&quot;,age:25};
Advanced JavaScript Browser Detection (name,version) Can get/set cookie Platform Detection (OS , UA) Client side form Validations setTimeout(“statements”,millseconds)
AJAX AJAX = Asynchronous JavaScript and XML. Not a new programming language, uses existing standards Can exchange data and partical update without page refersh
How does it work
Existing standards XMLHttpRequest object (to exchange data asynchronously with a server) JavaScript/DOM (to display/interact with the information) CSS (to style the data) XML (often used as the format for transferring data)
Example <html><head><script type=&quot;text/javascript&quot;> function loadXMLDoc(){ var xmlhttp; if (window.XMLHttpRequest)   {// code for IE7+, Firefox, Chrome, Opera, Safari   xmlhttp=new XMLHttpRequest(); }else   {// code for IE6, IE5   xmlhttp=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);   }   xmlhttp.onreadystatechange=function(){   if (xmlhttp.readyState==4 && xmlhttp.status==200) {   document.getElementById(&quot;myDiv&quot;).innerHTML=xmlhttp.responseText; } } xmlhttp.open(&quot;GET&quot;,&quot;ajax_info.txt&quot;,true); xmlhttp.send(); }</script></head><body> <div id=&quot;myDiv&quot;><h2>Let AJAX change this text</h2></div> <button type=&quot;button&quot; onclick=&quot;loadXMLDoc()&quot;>Change Content</button> </body></html>
Request Methods open(method,url,async) Method – post, get send(string) setRequestHeader(&quot;Content-type&quot;,&quot;application/x-www-form-urlencoded&quot;);
Response responseText Gets the response data as string responseXML Gets the response data as XML
readyState onreadystatechange readyState 0: request not initialized 1: server connection established 2: request received 3: processing request 4: request finished and response is ready status 200 : OK 404 : page not found
AJAX Advanced Using server side scripts PHP, ASP, JSP Using databse  Databse connection from Server scripts Using XML  DOM parsing
Thank You ! Thank You !
Ad

Recommended

PPT
Ajax
Pranay Rana
 
PPT
Ajax
devisp
 
PPT
Java Script
siddaram
 
PPTX
Java Script
husbancom
 
PPT
Java script programs
ITz_1
 
PPT
HTML Introduction
Jainul Musani
 
PPTX
Introduction to java_script
Basavaraj Hampali
 
DOCX
Introduction of javascript
syeda zoya mehdi
 
PDF
Pracitcal AJAX
jherr
 
PPT
Java script
ITz_1
 
PPT
JavaScript - Part-1
Jainul Musani
 
PPT
JavaScript
Doncho Minkov
 
PPT
JavaScript Missing Manual, Ch. 1
Gene Babon
 
PPT
Java script
Fajar Baskoro
 
PDF
JAVA SCRIPT
Mohammed Hussein
 
PPT
Java script
umesh patil
 
PDF
AngularJS Basics
Manaday Mavani
 
PPT
JavaScript Introduction
Jainul Musani
 
PPTX
Jsp
JayaKamal
 
PPTX
Introduction To JavaScript
Reema
 
PPT
Java script
umesh patil
 
PDF
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
tutorialsruby
 
PPT
Javascript 2009
borkweb
 
PDF
360 Realtors LLP
Vinit Kumar
 
PDF
Gdz nimecka sidorenko_2011
Lucky Alex
 
PDF
Presentazione medialert
francesco martinelli
 
PDF
Presentazione medianews
francesco martinelli
 
PPS
Luxuria
Mensagens Virtuais
 

More Related Content

What's hot (17)

DOCX
Introduction of javascript
syeda zoya mehdi
 
PDF
Pracitcal AJAX
jherr
 
PPT
Java script
ITz_1
 
PPT
JavaScript - Part-1
Jainul Musani
 
PPT
JavaScript
Doncho Minkov
 
PPT
JavaScript Missing Manual, Ch. 1
Gene Babon
 
PPT
Java script
Fajar Baskoro
 
PDF
JAVA SCRIPT
Mohammed Hussein
 
PPT
Java script
umesh patil
 
PDF
AngularJS Basics
Manaday Mavani
 
PPT
JavaScript Introduction
Jainul Musani
 
PPTX
Jsp
JayaKamal
 
PPTX
Introduction To JavaScript
Reema
 
PPT
Java script
umesh patil
 
PDF
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
tutorialsruby
 
PPT
Javascript 2009
borkweb
 
Introduction of javascript
syeda zoya mehdi
 
Pracitcal AJAX
jherr
 
Java script
ITz_1
 
JavaScript - Part-1
Jainul Musani
 
JavaScript
Doncho Minkov
 
JavaScript Missing Manual, Ch. 1
Gene Babon
 
Java script
Fajar Baskoro
 
JAVA SCRIPT
Mohammed Hussein
 
Java script
umesh patil
 
AngularJS Basics
Manaday Mavani
 
JavaScript Introduction
Jainul Musani
 
Introduction To JavaScript
Reema
 
Java script
umesh patil
 
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
tutorialsruby
 
Javascript 2009
borkweb
 

Viewers also liked (10)

PDF
360 Realtors LLP
Vinit Kumar
 
PDF
Gdz nimecka sidorenko_2011
Lucky Alex
 
PDF
Presentazione medialert
francesco martinelli
 
PDF
Presentazione medianews
francesco martinelli
 
PPS
Luxuria
Mensagens Virtuais
 
PPTX
Proyecto Final Redes Sociales
nuvia16
 
PDF
Instituto progredir
Instituto Progredir
 
PPTX
Portifólio – 1ºsemestre 2013
Edilaine Da Silva Lima
 
PPTX
El uso de la tecnologia
juanito2013
 
360 Realtors LLP
Vinit Kumar
 
Gdz nimecka sidorenko_2011
Lucky Alex
 
Presentazione medialert
francesco martinelli
 
Presentazione medianews
francesco martinelli
 
Proyecto Final Redes Sociales
nuvia16
 
Instituto progredir
Instituto Progredir
 
Portifólio – 1ºsemestre 2013
Edilaine Da Silva Lima
 
El uso de la tecnologia
juanito2013
 
Ad

Similar to Introduction to javaScript (20)

PPT
Ajaxppt
vsnmurthy
 
PPT
Ajaxppt
Ratna Prashanth
 
PPTX
Javazone 2010-lift-framework-public
Timothy Perrett
 
PPT
Ajax
Pranay Rana
 
ODP
Linux Apache Php Mysql Lamp1273
hussulinux
 
PPT
Ajax Introduction
Oliver Cai
 
PPT
Javascript
mussawir20
 
PPT
Ajax ppt
Sanmuga Nathan
 
PPT
Ajax Ppt
Hema Prasanth
 
PPT
JSP diana y yo
michael
 
PPT
Javascript: Ajax & DOM Manipulation v1.2
borkweb
 
PPT
Jsp
DSKUMAR G
 
PPT
29 Jsp
DSKUMAR G
 
PPT
Ajax
Rathan Raj
 
PPT
Jsp 01
Subhasis Nayak
 
PPT
Intro on GWT & Google APIs (Vikram Rangnekar, COO of Socialwok.com)
Singapore Google Technology User Group
 
PPT
Javascript survival for CSBN Sophomores
Andy de Vera
 
ODP
Developing and testing ajax components
Ignacio Coloma
 
ODP
JavaScript and jQuery Fundamentals
BG Java EE Course
 
PPT
Javascript
Iblesoft
 
Ajaxppt
vsnmurthy
 
Javazone 2010-lift-framework-public
Timothy Perrett
 
Linux Apache Php Mysql Lamp1273
hussulinux
 
Ajax Introduction
Oliver Cai
 
Javascript
mussawir20
 
Ajax ppt
Sanmuga Nathan
 
Ajax Ppt
Hema Prasanth
 
JSP diana y yo
michael
 
Javascript: Ajax & DOM Manipulation v1.2
borkweb
 
29 Jsp
DSKUMAR G
 
Intro on GWT & Google APIs (Vikram Rangnekar, COO of Socialwok.com)
Singapore Google Technology User Group
 
Javascript survival for CSBN Sophomores
Andy de Vera
 
Developing and testing ajax components
Ignacio Coloma
 
JavaScript and jQuery Fundamentals
BG Java EE Course
 
Javascript
Iblesoft
 
Ad

More from Neil Ghosh (10)

PPTX
GOLD AG Report in IEEE Hyderabad AGM 2013
Neil Ghosh
 
PPTX
Introduction to JavaFx and HTML5
Neil Ghosh
 
PPTX
GOLD at IEEE Hyderabad SAGM 2012
Neil Ghosh
 
PPT
Astronomy at Pecha Kuch Night Hyderabad Volume 9
Neil Ghosh
 
PDF
Astro quiz
Neil Ghosh
 
PPTX
IEEE GOLD STEP
Neil Ghosh
 
ODP
RestFull Webservices with JAX-RS
Neil Ghosh
 
PPT
Intro to web services
Neil Ghosh
 
ODP
Creating REST Webservice With NetBeans
Neil Ghosh
 
PPT
Edited
Neil Ghosh
 
GOLD AG Report in IEEE Hyderabad AGM 2013
Neil Ghosh
 
Introduction to JavaFx and HTML5
Neil Ghosh
 
GOLD at IEEE Hyderabad SAGM 2012
Neil Ghosh
 
Astronomy at Pecha Kuch Night Hyderabad Volume 9
Neil Ghosh
 
Astro quiz
Neil Ghosh
 
IEEE GOLD STEP
Neil Ghosh
 
RestFull Webservices with JAX-RS
Neil Ghosh
 
Intro to web services
Neil Ghosh
 
Creating REST Webservice With NetBeans
Neil Ghosh
 
Edited
Neil Ghosh
 

Recently uploaded (20)

PDF
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
PDF
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
PDF
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
PDF
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
PDF
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
PPTX
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
PDF
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
PDF
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
PDF
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
PDF
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PPTX
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
PDF
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
PPTX
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
PDF
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
Cyber Defense Matrix Workshop - RSA Conference
Priyanka Aash
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Agentic AI for Developers and Data Scientists Build an AI Agent in 10 Lines o...
All Things Open
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 

Introduction to javaScript

  • 1. Introduction to JavaSctipt Introduction to JavaScript by Sabyasachi Ghosh http://neilghosh.com
  • 2. A Programming Language A client side scripting langugage Downloaded as is from server Can be generated using server side scripting Nothing to do with Java No Compilation required Most of the browsers support it Its free !
  • 3. How Does it look like <html> <body> <h1>My First Web Page</h1> <script type=&quot;text/javascript&quot;> document.write(&quot;<p>&quot; + Date() + &quot;</p>&quot;); </script> </body> </html>
  • 4. Printing and Variables document.write(&quot;Hello World ! &quot;); var x; var x= 10; var name = “Neil”; = is used to assign values. + is used to add/concat values.
  • 5. Conditional and Looping Similar to C and and JAVA If(condition){..} else{..} switch .. case .. for(i=1;i<10;i++){..} while(i<10){} for(i in X){ .. X[i] .. } /where var X = {x:10,y:20}
  • 6. Pop-Ups alert(&quot;I am an alert box!&quot;); var r=confirm(&quot;Press a button&quot;); var name=prompt(&quot;Please enter your name&quot;,&quot;Harry Potter&quot;);
  • 7. Functions and Events Defination function add(x,y){ return x +y ; } Call var z= (x,y); <input type=&quot;button&quot; value=&quot;Click me!&quot; onclick=&quot;myFunc()&quot; /> Similarly onLoad,onUnload,onFocus, onBlur, onChange,onSubmit,onMouseOver
  • 8. JavaScript Objects String length(),toUpperCase() Date var today = new Date() , setDate Array var myCars=new Array(); myCars[0] Boolean Custom var person={fname:&quot;John&quot;,lname:&quot;Doe&quot;,age:25};
  • 9. Advanced JavaScript Browser Detection (name,version) Can get/set cookie Platform Detection (OS , UA) Client side form Validations setTimeout(“statements”,millseconds)
  • 10. AJAX AJAX = Asynchronous JavaScript and XML. Not a new programming language, uses existing standards Can exchange data and partical update without page refersh
  • 11. How does it work
  • 12. Existing standards XMLHttpRequest object (to exchange data asynchronously with a server) JavaScript/DOM (to display/interact with the information) CSS (to style the data) XML (often used as the format for transferring data)
  • 13. Example <html><head><script type=&quot;text/javascript&quot;> function loadXMLDoc(){ var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById(&quot;myDiv&quot;).innerHTML=xmlhttp.responseText; } } xmlhttp.open(&quot;GET&quot;,&quot;ajax_info.txt&quot;,true); xmlhttp.send(); }</script></head><body> <div id=&quot;myDiv&quot;><h2>Let AJAX change this text</h2></div> <button type=&quot;button&quot; onclick=&quot;loadXMLDoc()&quot;>Change Content</button> </body></html>
  • 14. Request Methods open(method,url,async) Method – post, get send(string) setRequestHeader(&quot;Content-type&quot;,&quot;application/x-www-form-urlencoded&quot;);
  • 15. Response responseText Gets the response data as string responseXML Gets the response data as XML
  • 16. readyState onreadystatechange readyState 0: request not initialized 1: server connection established 2: request received 3: processing request 4: request finished and response is ready status 200 : OK 404 : page not found
  • 17. AJAX Advanced Using server side scripts PHP, ASP, JSP Using databse Databse connection from Server scripts Using XML DOM parsing
  • 18. Thank You ! Thank You !