Lesson-1 - Writing and testing your first script

      Ok, how are we doing on time? We have a lot to cover today and I don't want to keep you here too late. So let me look at my clock and see what time it is . Oh, it is only a little after 1:06, so we still have plenty of time to get into an Introduction of JavaScript.
Opps! Sorry, there I go showing some of the power of JavaScript instead of teaching it. I will try to keep my mind on the teaching for the rest of this lesson :-)
What is JavaScript?
I have already shown you that JavaScript can be used to display a specific greeting based on the time of day and can be used to generate a simple clock.
It can also display today's date and time in many different formats:
August 9, 2004
Monday, August 9, 2004
9.8.04
09 Austos 2004 Pazartesi 01:06:35
There are only -1682 days until the year 2000.
It can put scrolling text on your page:

It can put a drop down menu on your page:

This menu has been disabled but you will will learn how to do the real thing is this class.
It can get basic information about your visitor and his Browser:
I see you have a computer with windows installed.
Browser: Microsoft Internet Explorer
JavaScript is enabled!
You are currently in an area whose time is 5 hours ahead of GMT. Opps, JavaScript is not enabled on your browser
Email Instructor and ask how to enable.
Be sure to information on your browser in the email.
It can do some cool things with images, such as a rollover:

It can do pop-up windows:
Click here to view a JavaScript pop-up window
It is fast:
JavaScript is 100% text, just like HTML is. Therefore it loads quickly from the server to your computer. JavaScript runs on your computer and does not have to download any additional applications to do it's job.
It can be mixed with HTML:
You use the HTML tag combination // to identify JavaScript. This makes it HTML friendly.
It can be annoying to your visitors:
if you use too much.
are more interested in doing cute things rather than adding functionality to your page
take away some of the browser features that your visitor relies on, example using the status bar at the bottom of your browser for something that keeps your visitor from seeing normal messages.
It can be frustrating to develop:
When you make a mistake and try to trouble shoot. But so can HTML! Have you ever left off a closing tag such as
and spent some time trying to find the mistake among the many tag combinations on your page.
It is Object Oriented:
JavaScript is composed of what is called objects that have properties and methods. The window that you are now using is an object that has properties such as height and width. Methods do things for us. For instance, I used a JavaScript method to open the pop-up window in the demo above. The pop-up window contains a close button. Pressing this button causes another JavaScript method to run and close the window. We will be talking about objects in lesson 7.
It is not Java:
Java is a compiled language, i.e. put into machine language before it gets to your computer. JavaScript is an interpreted language, i.e. put into machine language on your computer. The coding in JavaScript is somewhat similar to Java but it is much less restrictive. For example, as you will learn in lesson 4, JavaScript allows you to assign any type of value to your variables. Java does not. Java is a language that experienced programmers use to develop applications. JavaScript is for us less experienced web developers. JavaScript was originally developed independent of Java by Netscape under the name of LiveScript. Netscape changed the name to JavaScript in 1995 as a result of an agreement with Sun, the developer of Java.
It is called jscript by Microsoft: Microsoft Internet Explorer browsers have what is called jscript. The results from a browser that has jscript is basically the same as one that has JavaScript. The documentation that Microsoft provides makes it look a little different. Call it what you want to, the bottom line is that JavaScript works on the Internet Explorer browsers.
Our First Script
Let's start our journey into the learning of JavaScript by typing in the following HTML code. We will add to it and eventually wind up with a working clock similar to the one above. Of course it will take us a several lessons to get there because we first need to learn the basics.
Our First Script

Our First Script

Today is

Хостинг от uCoz
Save this code as script1.html. It looks something like this when we load it into our browser by using File/Open on the menu.
Our First Script
Today is
Хостинг от uCoz