Beginning JavaScript
Download
Report
Transcript Beginning JavaScript
Beginning JavaScript
4th Edition
Chapter 1
Introduction to JavaScript
and the Web
Chapter 1 Objectives
What is JavaScript?
What do you need in order to use
JavaScript?
What can JavaScript do for you?
What is JavaScript?
A computer language: a series of
instructions that tell the computer to
do something
What is JavaScript?
An interpreted language rather than a
compiled language
What is JavaScript?
What is JavaScript?
JavaScript is interpreted when the
code is run.
This interpretation has to be repeated
every time the code is run.
What is JavaScript?
JavaScript is not Java
What do you need?
All you need to create and use
JavaScript is:
• A text editor, such as Notepad
• A Web browser, such as Firefox (FF)
or Internet Explorer (IE) to view your
pages in
What can JavaScript do for you?
Add interactivity to your Web pages
Help you obtain information from
visitors to your Web site
Enable you to validate the
information you receive
Adding JavaScript to your pages
Insert JavaScript code in
HTML/XHTML pages between an
opening and closing script tag:
<script>
</script>
Adding JavaScript to your pages
It’s good practice to include a type
attribute in the opening script tag:
<script type="text/javascript">
Adding JavaScript to your pages
<script type="text/javascript">
</script>
Adding JavaScript to your pages
<script type="text/javascript">
document.bgColor="RED";
</script>
Adding JavaScript to your pages
<script type="text/javascript">
// script block 1
document.bgColor="RED";
</script>
Using JavaScript
JavaScript enables you to
make your Web pages