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 !

More Related Content

PPT
PPT
Ajax
PPT
Java Script
PPTX
Java Script
PPT
Java script programs
PPT
HTML Introduction
PPTX
Introduction to java_script
Ajax
Java Script
Java Script
Java script programs
HTML Introduction
Introduction to java_script

What's hot (17)

DOCX
Introduction of javascript
PDF
Pracitcal AJAX
PPT
Java script
PPT
JavaScript - Part-1
PPT
JavaScript
PPT
JavaScript Missing Manual, Ch. 1
PPT
Java script
PDF
JAVA SCRIPT
PPT
Java script
PDF
AngularJS Basics
PPT
JavaScript Introduction
PPTX
PPTX
Introduction To JavaScript
PPT
Java script
PDF
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
PPT
Javascript 2009
Introduction of javascript
Pracitcal AJAX
Java script
JavaScript - Part-1
JavaScript
JavaScript Missing Manual, Ch. 1
Java script
JAVA SCRIPT
Java script
AngularJS Basics
JavaScript Introduction
Introduction To JavaScript
Java script
Essential Javascript -- A Javascript &lt;b>Tutorial&lt;/b>
Javascript 2009
Ad

Viewers also liked (10)

PDF
360 Realtors LLP
PDF
Gdz nimecka sidorenko_2011
PDF
Presentazione medialert
PDF
Presentazione medianews
PPS
PPTX
Proyecto Final Redes Sociales
PDF
Instituto progredir
PPTX
Portifólio – 1ºsemestre 2013
PPTX
El uso de la tecnologia
360 Realtors LLP
Gdz nimecka sidorenko_2011
Presentazione medialert
Presentazione medianews
Proyecto Final Redes Sociales
Instituto progredir
Portifólio – 1ºsemestre 2013
El uso de la tecnologia
Ad

Similar to Introduction to javaScript (20)

PPT
Pascarello_Investigating JavaScript and Ajax Security
PPS
Advisor Jumpstart: JavaScript
PPT
Ajax presentation
PPTX
BITM3730 10-3.pptx
PPTX
BITM3730 10-4.pptx
PPTX
javaScript and jQuery
PPTX
BITM3730Week6.pptx
PPT
PPT
PPTX
Data and information about anatical subject
PPTX
Web technologies-course 10.pptx
PPT
PPT
Using Ajax In Domino Web Applications
PPT
PPTX
Java script
Pascarello_Investigating JavaScript and Ajax Security
Advisor Jumpstart: JavaScript
Ajax presentation
BITM3730 10-3.pptx
BITM3730 10-4.pptx
javaScript and jQuery
BITM3730Week6.pptx
Data and information about anatical subject
Web technologies-course 10.pptx
Using Ajax In Domino Web Applications
Java script

More from Neil Ghosh (10)

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

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Machine learning based COVID-19 study performance prediction
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
NewMind AI Weekly Chronicles - August'25 Week I
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine learning based COVID-19 study performance prediction
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
Chapter 3 Spatial Domain Image Processing.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Electronic commerce courselecture one. Pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf

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 !