• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Hello world
 

Hello world

on

  • 284 views

 

Statistics

Views

Total Views
284
Views on SlideShare
284
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Hello world Hello world Presentation Transcript

    • Hello World!Traditional programming tutorial
    • Copy the following code and save it in a text editor as hello.html<html><head> <title></title></head><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>
    • RememberScript tags are within the head section, not the body section.
    • 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>
    • 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>
    • 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 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>
    • 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>
    • Your turnAfter saving yourwork, try openingyour webpage.It should look likethis
    • 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!