JavaScript-Intro by Voodoo I have mentioned it before but I think it is important to repeat it. JAVA IS NOT JAVASCRIPT! There are many differences. Many postings about Java in the newsgroup comp.lang.javascript prove that there is a lack of information. The other way round questions about JavaScript shall be posted to comp.lang.javascript NOT to comp.lang.java. The techniques used in Java and JavaScript differ so much because Java is a programming language and JavaScript is a scripting language. This languages are two different languages with different purposes. I must admit that the two almost similar names may seem to be the same. But this is not so! Please take this into consideration when you ask somebody about Java or JavaScript. ---------- JavaScript-Intro by Voodoo INTRODUCTION TO JAVASCRIPT c 1996 by Stefan Koch - All rights reserved. This page without tables and pics... -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Part 1: What is JavaScript? Running JavaScript scripts Embedding scripts into HTML A first function Form elements Last changed - date -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Part 4: The statusbar The setTimeout function Programming a scroller -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Part 2: Information in the statusbar Date object Creating random numbers Working with windows -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- PART 5: Arrays How to clear a document Back and Forward- buttons -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- PART 7: Validating forms Submitting form input How to set the focus to a certain element -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Part 3: Working with frames -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- PART 6: Load two frames with one click Opening a new window when a link is taken Operators -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -=- [TABLE] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- You found this page at http://rummelplatz.uni-mannheim.de/ ~skoch/js/script.htm Stefan's Home - e-Mail ---------- JavaScript-Intro by Voodoo This page with tables... This is an introduction to JavaScript. You will learn the basic elements needed for embedding JavaScript scripts into HTML- pages. I have written some easy to understand examples, from which you can learn. Introduction to JavaScript - Part 1: What is JavaScript? Running JavaScript scripts Embedding scripts into HTML A first function Form elements Last changed - date Introduction to JavaScript - Part 2: Information in the statusbar Date object Creating random numbers Working with windows Introduction to JavaScript - Part 3: Working with frames Introduction to JavaScript - Part 4: The statusbar The setTimeout function Programming a scroller Introduction to JavaScript - Part 5: Arrays How to clear a document Back and Forward- buttons Introduction to JavaScript - Part 6: Load two frames with one click Opening a new window when a link is taken Operators Introduction to JavaScript - Part 7: Validating forms Submitting form input How to set the focus to a certain element Play a little JavaScript- game Get a copy of this page so you can read it offline (62.1kB) (Last update: 9.April'96) About changes to JavaScript Java is not the same as JavaScript! Mirror- Sites: My german homepage My site at Webconn Australia - Vince Mankelow Austria- Franz Knipp Italy Sweden - Mikael Nicolaidis New Zealand If you want to read this document in other languages: Chinese - translated by Been-Chian Chien Chinese - translated by Shii-Tyng Duann Czech - translated by Pavel JANIK ml. German - translated by Veikko Wuensche Links to other JavaScript ressources: Many links to other JavaScript pages Read the JavaScript- FAQ (Frequently Asked Questions) Netscape - Home Download Netscape Navigator 2.0 You are visitor number to this page. Stefan's Home - e-Mail ---------- Introduction to JavaScript - Part1 Introduction to JavaScript Part 1 What is JavaScript? JavaScript is a new scripting language for Web- pages. Scripts written with JavaScript can be embedded into your HTML- pages. With JavaScript you have very many possibilities for enhancing your HTML- page with interesting elements. For example you are able to respond to user- initiated events quite easily. Some effects that are now possible with JavaScript were some time ago only possible with CGI. So you can create really sophisitcated pages with the help of JavaScript. You can see many examples for JavaScript scripts on the Internet. Best you have a look at some JavaScript enhanced pages. You can find many links at Gamelan (in the JavaScript section). You will find the documentation provided by Netscape at http:/ /home.netscape.com. What is the difference between Java and JavaScript? Although the names are almost the same Java is not the same as JavaScript! These are two different techniques for Internet programming. Java is a programming language. JavaScript is a scripting language (as the name implies). The difference is that you can create real programs with Java. But often you just want to make a nice effect without having to bother about real programming. So JavaScript is meant to be easy to understand and easy to use. JavaScript authors should not have to care too much about programming. You could say that JavaSript is rather an extension to HTML than a separate computer language. Of course this is not the 'official' definition but I think this makes it easier to understand the difference between Java and JavaScript. You can find further information about both Java and JavaScript at Gamelan. For further information about this topic please read the introduction provided by Netscape. How can JavaScript scripts be run? The first browser to support JavaScript was the Netscape Navigator 2.0. Of course the higher versions do have JavaScript as well. You might know that Java does not run on all Netscape Navigator 2.0 (or higher) versions. But this is not true for JavaScript - although there are some problems with the different versions. The Mac- version for example seems to have many bugs. In the near future there are going to be some other browsers which support JavaScript. The Microsoft Internet Explorer 3.0 is going to support JavaScript. JavaScript- enabled browsers are going to be wide spread soon - so it is worth learning this new technique now. You might realize that is really easy to write JavaScript scripts. All you have to know is some basic techniques and some work- arounds for problems you might encounter. Of course you need a basic understanding of HTML before reading this tutorial. You can find many really good online ressources about HTML. Best you make an online search about 'html' at Yahoo if you want to get informed about HTML. (These online- documents are often more up-to-date than books. The Internet is moving quite fast these days...) Now I want to show some small scripts so you can learn how they are implemented into HTML- documents and to show which possibilities you have with the new scripting language. I will begin with a very small script which will only print a text into an HTML- document. -=- [PREFORMATTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
My first JavaScript!