Hello world

302 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
302
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Hello world

  1. 1. Hello World!Traditional programming tutorial
  2. 2. Copy the following code and save it in a text editor as hello.html<html><head> <title></title></head><body></body></html>
  3. 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. 4. RememberScript tags are within the head section, not the body section.
  5. 5. Let’s make a function• A function executes a <html> series of instructions. <head> <title></title>• We will start with an <script empty shell type="text/javascript"> function () { } </script> </head> <body> </body> </html>
  6. 6. Function nameWe will name our <html> <head>function Helloworld. <title></title> <scriptWe will add an alert box type="text/javascript">that say’s “Hello function HelloWorld() {World!” alert ("Hello World!"); } </script> </head> <body> </body> </html>
  7. 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. 8. Execute FunctionNow that we have <html> <head>covered the function <title></title> <scripthead tags, let’s make it type="text/javascript">execute when we click function HelloWorld() {on a link. Here is a alert ("Hello World!"); }generic link that point </script> </head>nowhere: <body> <a href="">Hello</a> </body> </html>
  9. 9. Execute FunctionThis will make it point <html> <head>to our function <title></title> <script type="text/javascript"> function HelloWorld() { alert ("Hello World!"); } </script> </head> <body> <a href="javascript:HelloW orld()">Hello</a> </body> </html>
  10. 10. Your turnAfter saving yourwork, try openingyour webpage.It should look likethis
  11. 11. Your first JavaScriptCongratulations, you just made your firstjavaScript!There are two things I would like you toremember:1. JavaScript and Java are not the same thing.2. JavaScript is case-sensitive!

×