Java Script

"It's easy to get confused and think that Java and JavaScript are one in the same.
Not so. Java is a programming language developed at Sun Microsystems.
JavaScript, on the other hand, was created at Netscape."

 

What is Java Script?

Java Script is a Object orientated Programming language, as well as Java. The main diferrence is that Java programming can create fully stand-alone events. JavaScript cannot stand alone. It must be running inside of a Web page, and the Web page must be displayed in a browser that understands the JavaScript language.

Writing JavaScript

JavaScript is not HTML! JavaScript goes inside the HTML document and is saved as text right along with the HTML document. The major difference between the two is that HTML is very forgiving in terms of its shape. White space means nothing to HTMl. The opposite is true in JavaScript. It does have a shape.

Editing JavaScript

Whether we're editing or writing script, we can not allow margings to get in the way. JavaScript is Case Sensitive. The first line of text looks like this:

<SCRIPT LANGUAGE="JavaScript">

This is the HTML code to alert the browser that what immediately follows is going to be a JavaScript script. All JavaScripts start with this exact command. All JavaScript scripts end with the following command:

</SCRIPT>

Examples

The bellow script posts the exact day and time you arrived at this page:

<SCRIPT LANGUAGE="Javascript">
RightNow = new Date();
document.write("Today's date is " + (RightNow.getMonth() +
"-" + RightNow.getDate() + "-" + RightNow.getFullYear() + ".
You entered this Web Page at exactly:" + RightNow.getHours() +
":" + RightNow.getMinutes() + " and " + RightNow.getSeconds() +
"seconds"))
</SCRIPT>

The document.write line above should be all on one line. You could see the effect here

The next script shows you how to open a new window:

<SCRIPT LANGUAGE="javascript">
window.open('opened.html','Dani',config='height=300,width=300')
</SCRIPT>

See how it works by opening new window

Would you like to see more of this? World Wide Web is the best source of JavaScript. There are scripts everywhere.

Go to the top of the page.


[main] [contents] [conventions] [guide lines]
[html tags] [design] [navigation] [style sheets] [java script] [guest book]
Hosted by www.Geocities.ws

1