• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
 
Javascript for beginners
© Copyright Martin BaierTranslated from the German by Linda L. Gaus© Copyright 2000 Author and KnowWare
Acrobat Reader: How to ...
F5/F6
 
open/closes bookmarks -
F4
 
open/closes thumbnails
In menuViewyou can set, how the file is displayedC
TRL
+0
= Fit in Window,
C
TRL
+1
= Actual size,
C
TRL
+2
= Fit widthYou can set
S
INGLE PAGE
,
C
ONTINUOUS
V
IEW
or
C
ONTINUOUS
F
ACING
.. try them out and you will see the differences.
NavigationA
RROW LEFT
/
RIGHT
: forward/backwards one page
A
LT
+A
RROW LEFT
/
RIGHT
: same as in a browser: forward/back
C
TRL
++
zooms in
AND
C
TRL
+-
zooms out
www.knowwareglobal.com
 
Table of Contents
© Martin Baier and KnowWare - JavaScript for Beginners - 02-09-08 - 17:27
3
The Basics..........................................................5
The Necessary Software..................................5HTML..............................................................5
What are HTML Pages?.......................................5Brief HTML Reference Guide.............................5
HTML and JavaScript......................................7
Incorporation in the Header..................................7Carrying out Code Given Particular Actions........8Incorporation in the Body....................................8
First JavaScript Programming .......................9
Hello World.....................................................9
Hello World without Parameters..........................9Hello World with Parameters.............................10
What time is it?..............................................11Page Reference..............................................12
Event Handler.................................................13
onLoad...........................................................13onUnload........................................................13onMouseOver................................................14onMouseOut..................................................14onFocus..........................................................14onBlur............................................................16onChange.......................................................16onClick...........................................................17 javascript........................................................18onSubmit........................................................18
Functions.........................................................19Variables .........................................................20
Local Variables..............................................20Global Variables............................................21
Mathematical Operations..............................22Repeated Performance...................................23
Looping with for............................................23Looping with while........................................25
Conditional Operations..................................27Standard Objects............................................29
document........................................................29
Colors in the Document......................................29Document Properties..........................................31Pictures in a Document.......................................32
document.frames............................................35document.forms.............................................38
Text Entry Fields................................................38Radio and Check buttons....................................38Drop-Down Lists................................................38Pizza Service......................................................39
Euro Calculator..............................................41Strings ..............................................................43
The String Object...........................................44
length..................................................................44substring..............................................................44toLowerCase.......................................................44toUpperCase........................................................44
Moving Text...................................................44
User-Defined Objects......................................46Arrays...............................................................46Working with Frames.....................................46Quiz ..................................................................49The Explorer....................................................58
The Project......................................................58The Practice....................................................58
The Main Page....................................................58The Content Page................................................60The Explorer Page..............................................60
Customization.................................................65
Reserved Words ..............................................66The Last Word… ............................................66
 
Introduction
© Martin Baier and KnowWare - JavaScript for Beginners - 02-09-08 - 17:27
4
Introduction
Everyone who is the least bit familiar with theInternet eventually wants to represent him or herself there with a home page. But the common page-building programs like Netscape Composer or Microsoft Frontpage no longer suffice for creating anything more than a very mediocrehome page. Anyone who wants to have a reallycool home page must know a little more than thecountless amateurs who are out there on theInternet. The easiest and best tool for creating atruly attractive and interactive home page iscalled JavaScript.The beautiful thing about JavaScript is that theknowledge and system-related prerequisites for learning the language are relatively low. You just need to know some HTML. And I’ll teachyou the most crucial things in the first section of this booklet. If you’d like to delve deeper, Irecommend the KnowWare booklet “Homepagesfor Beginners” by Johann-Christian Hanke.Since JavaScript is platform-independent, it can be used on almost any Mac or PC. As far assoftware is concerned, you’ll need just anInternet browser (preferably Netscape Navigator or Microsoft Internet Explorer) and a simpleASCII text editor, for example, the one thatcomes with Windows. ASCII text consists of unformatted letters, that is, for every letter, youneed to have one byte of hard disk spaceavailable. By contrast, Microsoft Word formatstext with fonts, colors, etc. and it’s not reallysuited to serve as an ASCII text editor.Finally, here’s a hint for reading this booklet:everything typed in
Courier
is code. To test iton the computer, you’ll have to type it in. You’llfind current information about JavaScript andupdates to the contents of this booklet on itscompanion page.The address is
www.knowwareglobal.com/javascript
Go have a look!I’d like to thank Dipl.-Informatiker ReinholdBaier for proofreading this booklet – thanks tohim, you’ve been spared many content- andlanguage-related mistakes.Finally, I’d like to ask one thing of you: if youhave comments about this booklet, whether  positive or negative, e-mail them to me! I’malways very open to having you do that.I wish you much enjoyment in programming andI’m sure that your home page will, in the future,set itself apart from the masses of theWYSIWYG editor sites because of JavaScript.Weilheim, July 2000Martin Baier (
 martin.baier@gmx.net
)
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...