KEMBAR78
1. introduction to java script | ODP
An Introduction to
JavaScript
What is a Scripting Language?
● A scripting language is a computer language
with a series of commands within a file that is
capable of being executed without being
compiled.
● The best example of a client side scripting
language is JavaScript.
What is the difference between a scripting
language and a traditional programming
language?
"A script is what you give the actors. A program
is what you give the audience." -- Larry Wall
The way JavaScript works...
How to get JavaScript into
our page
Syntax Fun
● Each statement ends in a semicolon
● Whitespace doesn’t matter (almost
everywhere)
● Surround strings of characters with double
quotes(or single, both work, just be consistent).
● JavaScript, unlike HTML markup, is case
sensitive
JavaScript history
Create an alert
● The browser gives you a quick way to alert
your users through the alert function. Just call
alert with a string containing your alert
message, and the browser will give your user
the message in a nice dialog box.
● alert really should be used only when you truly
want to stop everything and let the user know
something.
Write directly into your document
● You can use a function document.write(“your
message”) to write arbitrary HTML and content
into your page at any point
How do I add code to my page?
<head>
<title>My First JavaScript</title>
</head>
<body>
<script>
At this point you know that’s where you should put your code.
</script>
</body>
</html>
● You can place your code in-line, in the <head>
element
● you can add your code in-line in the body of
the document
OR
● put your code in its own file and link to it from
the head
● Finally, you can link to an external file in the
body of your page
Thank You!

1. introduction to java script

  • 1.
  • 2.
    What is aScripting Language? ● A scripting language is a computer language with a series of commands within a file that is capable of being executed without being compiled. ● The best example of a client side scripting language is JavaScript.
  • 3.
    What is thedifference between a scripting language and a traditional programming language? "A script is what you give the actors. A program is what you give the audience." -- Larry Wall
  • 4.
  • 5.
    How to getJavaScript into our page
  • 6.
    Syntax Fun ● Eachstatement ends in a semicolon ● Whitespace doesn’t matter (almost everywhere) ● Surround strings of characters with double quotes(or single, both work, just be consistent). ● JavaScript, unlike HTML markup, is case sensitive
  • 7.
  • 8.
    Create an alert ●The browser gives you a quick way to alert your users through the alert function. Just call alert with a string containing your alert message, and the browser will give your user the message in a nice dialog box. ● alert really should be used only when you truly want to stop everything and let the user know something.
  • 9.
    Write directly intoyour document ● You can use a function document.write(“your message”) to write arbitrary HTML and content into your page at any point
  • 10.
    How do Iadd code to my page? <head> <title>My First JavaScript</title> </head> <body> <script> At this point you know that’s where you should put your code. </script> </body> </html>
  • 11.
    ● You canplace your code in-line, in the <head> element ● you can add your code in-line in the body of the document OR ● put your code in its own file and link to it from the head ● Finally, you can link to an external file in the body of your page
  • 12.