SlideShare une entreprise Scribd logo
1  sur  11
Hello World!

Traditional programming tutorial
Copy the following code and save it in
     a text editor as hello.html
<html>
                         You can use any text editor of
<head> <title></title>   your choice. I prefer
                         notepad ++
</head>                  http://notepad-plus-
                         plus.org/download/v6.2.html
<body>
</body>
</html>
Add script tags within head section
 The scripts tags tell the   <html>
                             <head>
 browser that there is       <title></title>
 scripting contained
                             <script
 between (in this case
                               type="text/javascript">
 “javaScript”).
                             </script>
                             </head>
                             <body>
                             </body>
                             </html>
Remember
Script tags are within the head section, not the
  body section.
Let’s make a function
                                 <html>
                                 <head>
• A function executes a series   <title></title>
  of instructions.
                                 <script type="text/javascript">
• We will start with an empty
  shell                          function ()
                                  {
                                 }

                                 </script>

                                 </head>
                                 <body>

                                 </body>
                                 </html>
Function name
                           <html>
                           <head>
We will name our           <title></title>
                           <script type="text/javascript">
function HelloWorld.
                           function    HelloWorld()
                           {
We will add an alert box       alert ("Hello World!");
that say’s “Hello          }

World!”
                           </script>

                           </head>
                           <body>

                           </body>
                           </html>
Function Structure
• The word function declares that there is a
  function.
• The function name is HelloWorld.
• Parentheses () (has use we will get to later in
  the course)
• {} curly brackets contain the set of instructions
Execute Function
                           <html>
                           <head>
Now that we have           <title></title>
covered the function
                           <script type="text/javascript">
head tags, let’s make it
execute when we click       function HelloWorld()
                           {
on a link.                         alert ("Hello World!");
                            }

                           </script>
 Here is a generic link
that point nowhere:        </head>
                           <body>

                           <a href="">Hello</a>
                           </body>
                           </html>
Execute Function
                          <html>
                          <head>
                          <title></title>
This will make it point
to our function           <script type="text/javascript">
                          function HelloWorld()
                          {
                               alert ("Hello World!");
                          }

                          </script>

                          </head>
                          <body>
                          <a
                              href="  javascript:HelloWorld()">
                              Hello</a>

                          </body>
                          </html>
Your turn
After saving your
work, try opening
your
HelloWorld.html
file in your web
browser.

It should look like
this
Your first JavaScript
Congratulations, you just made your first
JavaScript!

There are two things I would like you to
remember:

1. JavaScript and Java are not the same thing.
2. JavaScript is case-sensitive!

Contenu connexe

Tendances

Jqeury ajax plugins
Jqeury ajax pluginsJqeury ajax plugins
Jqeury ajax pluginsInbal Geffen
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentationMevin Mohan
 
Using shortcode in plugin development
Using shortcode in plugin developmentUsing shortcode in plugin development
Using shortcode in plugin developmentgskhanal
 
Up & Running with Polymer
Up & Running with PolymerUp & Running with Polymer
Up & Running with PolymerFiyaz Hasan
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performanceYehuda Katz
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for JoomlaLuke Summerfield
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practicesmanugoel2003
 
Djangocon 2014 angular + django
Djangocon 2014 angular + djangoDjangocon 2014 angular + django
Djangocon 2014 angular + djangoNina Zakharenko
 
Black-Scholes Calculator on Web
Black-Scholes Calculator on WebBlack-Scholes Calculator on Web
Black-Scholes Calculator on WebEugene Yang
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery PresentationRod Johnson
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
Short intro to JQuery and Modernizr
Short intro to JQuery and ModernizrShort intro to JQuery and Modernizr
Short intro to JQuery and ModernizrJussi Pohjolainen
 

Tendances (20)

jQuery Best Practice
jQuery Best Practice jQuery Best Practice
jQuery Best Practice
 
Jqeury ajax plugins
Jqeury ajax pluginsJqeury ajax plugins
Jqeury ajax plugins
 
Jquery presentation
Jquery presentationJquery presentation
Jquery presentation
 
Using shortcode in plugin development
Using shortcode in plugin developmentUsing shortcode in plugin development
Using shortcode in plugin development
 
Java script
Java scriptJava script
Java script
 
jQuery PPT
jQuery PPTjQuery PPT
jQuery PPT
 
Up & Running with Polymer
Up & Running with PolymerUp & Running with Polymer
Up & Running with Polymer
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Sprout core and performance
Sprout core and performanceSprout core and performance
Sprout core and performance
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
jQuery in 15 minutes
jQuery in 15 minutesjQuery in 15 minutes
jQuery in 15 minutes
 
Djangocon 2014 angular + django
Djangocon 2014 angular + djangoDjangocon 2014 angular + django
Djangocon 2014 angular + django
 
Jquery image slider
Jquery image slider Jquery image slider
Jquery image slider
 
Black-Scholes Calculator on Web
Black-Scholes Calculator on WebBlack-Scholes Calculator on Web
Black-Scholes Calculator on Web
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Short intro to JQuery and Modernizr
Short intro to JQuery and ModernizrShort intro to JQuery and Modernizr
Short intro to JQuery and Modernizr
 
jQuery
jQueryjQuery
jQuery
 

En vedette

Google Story Builder
Google Story BuilderGoogle Story Builder
Google Story Builderdallesasse
 
Google Course Builder
Google Course BuilderGoogle Course Builder
Google Course Builderllynn83wou
 
Coursebuilder2
Coursebuilder2Coursebuilder2
Coursebuilder2llynn83wou
 
Google course builder
Google course builderGoogle course builder
Google course builderllynn83wou
 
Contenuti digitali aperti: tra licenze, inclusione e riuso
Contenuti digitali aperti: tra licenze, inclusione e riusoContenuti digitali aperti: tra licenze, inclusione e riuso
Contenuti digitali aperti: tra licenze, inclusione e riusoAlberto Ardizzone
 

En vedette (6)

Google Story Builder
Google Story BuilderGoogle Story Builder
Google Story Builder
 
Google Course Builder
Google Course BuilderGoogle Course Builder
Google Course Builder
 
Coursebuilder2
Coursebuilder2Coursebuilder2
Coursebuilder2
 
Google course builder
Google course builderGoogle course builder
Google course builder
 
Contenuti digitali aperti: tra licenze, inclusione e riuso
Contenuti digitali aperti: tra licenze, inclusione e riusoContenuti digitali aperti: tra licenze, inclusione e riuso
Contenuti digitali aperti: tra licenze, inclusione e riuso
 
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job? Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
Succession “Losers”: What Happens to Executives Passed Over for the CEO Job?
 

Similaire à HelloWorld

jQuery Mobile: For Fun and Profit
jQuery Mobile: For Fun and ProfitjQuery Mobile: For Fun and Profit
jQuery Mobile: For Fun and ProfitDaniel Cousineau
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxVivekBaghel30
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
Zen codingcheatsheet
Zen codingcheatsheetZen codingcheatsheet
Zen codingcheatsheetgoldenveizer
 
Quan Head Tag Presentation
Quan Head Tag PresentationQuan Head Tag Presentation
Quan Head Tag PresentationQuanslides
 
Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8spierre
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用LearningTech
 
Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)Eueung Mulyana
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic templatevathur
 
Ng init | EPI Sousse
Ng init | EPI SousseNg init | EPI Sousse
Ng init | EPI SousseHamdi Hmidi
 
Java script how to
Java script how toJava script how to
Java script how tojulian vega
 

Similaire à HelloWorld (20)

jQuery Mobile: For Fun and Profit
jQuery Mobile: For Fun and ProfitjQuery Mobile: For Fun and Profit
jQuery Mobile: For Fun and Profit
 
JavaServer Pages
JavaServer PagesJavaServer Pages
JavaServer Pages
 
Java script
Java scriptJava script
Java script
 
Web Day-01.pptx
Web Day-01.pptxWeb Day-01.pptx
Web Day-01.pptx
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptx
 
Javascript - Beyond-jQuery
Javascript - Beyond-jQueryJavascript - Beyond-jQuery
Javascript - Beyond-jQuery
 
Lecture6
Lecture6Lecture6
Lecture6
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
Zen codingcheatsheet
Zen codingcheatsheetZen codingcheatsheet
Zen codingcheatsheet
 
Quan Head Tag Presentation
Quan Head Tag PresentationQuan Head Tag Presentation
Quan Head Tag Presentation
 
Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8
Pamela - Brining back the pleasure of hand-written HTML - Montréal Python 8
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用
 
JavaScript
JavaScriptJavaScript
JavaScript
 
React
React React
React
 
Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)Introduction to React and Flux (CodeLabs)
Introduction to React and Flux (CodeLabs)
 
Javascript ch8
Javascript ch8Javascript ch8
Javascript ch8
 
Basics
BasicsBasics
Basics
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 
Ng init | EPI Sousse
Ng init | EPI SousseNg init | EPI Sousse
Ng init | EPI Sousse
 
Java script how to
Java script how toJava script how to
Java script how to
 

HelloWorld

  • 2. Copy the following code and save it in a text editor as hello.html <html> You can use any text editor of <head> <title></title> your choice. I prefer notepad ++ </head> http://notepad-plus- plus.org/download/v6.2.html <body> </body> </html>
  • 3. Add script tags within head section The scripts tags tell the <html> <head> browser that there is <title></title> scripting contained <script between (in this case type="text/javascript"> “javaScript”). </script> </head> <body> </body> </html>
  • 4. Remember Script tags are within the head section, not the body section.
  • 5. Let’s make a function <html> <head> • A function executes a series <title></title> of instructions. <script type="text/javascript"> • We will start with an empty shell function () { } </script> </head> <body> </body> </html>
  • 6. Function name <html> <head> We will name our <title></title> <script type="text/javascript"> function HelloWorld. function HelloWorld() { We will add an alert box alert ("Hello World!"); that say’s “Hello } World!” </script> </head> <body> </body> </html>
  • 7. Function Structure • The word function declares that there is a function. • The function name is HelloWorld. • Parentheses () (has use we will get to later in the course) • {} curly brackets contain the set of instructions
  • 8. Execute Function <html> <head> Now that we have <title></title> covered the function <script type="text/javascript"> head tags, let’s make it execute when we click function HelloWorld() { on a link. alert ("Hello World!"); } </script> Here is a generic link that point nowhere: </head> <body> <a href="">Hello</a> </body> </html>
  • 9. Execute Function <html> <head> <title></title> This will make it point to our function <script type="text/javascript"> function HelloWorld() { alert ("Hello World!"); } </script> </head> <body> <a href=" javascript:HelloWorld()"> Hello</a> </body> </html>
  • 10. Your turn After saving your work, try opening your HelloWorld.html file in your web browser. It should look like this
  • 11. Your first JavaScript Congratulations, you just made your first JavaScript! There are two things I would like you to remember: 1. JavaScript and Java are not the same thing. 2. JavaScript is case-sensitive!