[Webscripting HomePage] | [Perl CGI HomePage]
Javascript Resources
Javascript
Javascript was introduced by Netscape at the latter part of 1995, after
Sun Microsystems released the JAVA
programming
language. People tend to confuse the two languages, when in reality their
only similarities are that they both start with J A V A and the basic
similarities that all programming languages have to each other.
Javascript is one of the components involved in Dynamic HTML (see HTML Guru for an extreme example ;)
which includes:
Dynamic HTML Component Survey |
Netscape |
MS IE |
Standard? |
HTML |
HTML |
Yes |
CSS |
CSS |
Yes |
DOM |
DOM |
Not in present browsers, but Soon (version 6?) |
ECMA-262 (Javascript) |
ECMA-262 (Javascript) |
(In recent 4.5+ browers) |
Java |
Java |
Yes (MS not supporting newer versions?) |
Layer Tag |
CSS Positioning |
No (Netscape 6 uses CSS Positioning, finally) |
Javascript Style Sheets |
VBScript |
No, and JSS is going goodbye |
|
DirectX etc. etc. |
No |
The DOM (Document Object Model) is the method used to give names to every
part of the browser so it can be manipulated by javascript.
W3C DOM
Web
Developers DOM
How to use Javascript:
You can use the <script> tag, either in the head or the body of a
document:
<Script language="Javascript" type="text/javascript"
src="file.js">
<!-- Hides from non javascript browers
(functions etc go here)
//--> (the // hides the end of the comment from Javascript, as // is a
javascript comment)
</script>
OR
Use the keyword "javascript:" in a link such as <a
href="javascript:code goes here">Linkname</a>
OR
Stick an "event" into a link, such as onMouseOver or onClick
and so on.
Javascript is more or less an object oriented language, and as such
reference to variables is a bit different.
Object |
Properties |
Methods |
document (or windowname.document) |
alinkcolor
anchors[ ]
applets[ ]
bgColor
cookie
domain
embeds[ ]
fgColor
forms[ ]
images[ ]
lastModified
linkColor
links[ ]
|
location
plugins[ ]
referer
title
URL
vlinkColor
classes (N4)
height (N4)
ids (N4)
layers[ ] (N4)
tags (N4)
width (N4)
activeElement (IE4)
|
all[ ] (IE4)
charset (IE4)
children[ ] (IE4)
defaultCharset (IE4)
expando (IE4)
parentWindow (IE4)
readyState (IE4)
|
|
open()
close()
clear()
write()
writeln()
|
window |
document
history
location
self
status
top
|
close()
confirm(question)
focus
open(url, name, features, replace)
|
Events |
onfocus
onchange
onclick
onload
onunload
onmouseover
onmouseout
onreset
onsubmit
|
Window and all form entries
Select and text input entries
Buttons, links. Return false to override default action
Window or image
window or image
links and images, return true to prevent URL showing in status
links and images, return true to prevent URL showing in status
Forms. Return false to prevent reset or submission
|
Keywords |
Debugging Javascript:
Javascript Resources:
This document last modified on:
(Page will grow greatly by Dec 2001)
Some Javascript Examples
Javascript Form
Validation
Javascript Examples 2
Javascript Examples 3
Javascript Examples 4
Javascript Examples 5
Javascript Examples 6
Javasacript Examples 6a
Handout 1
Javascript Examples 7
Handout 2
Creating New Objects
Handout 3
Javascript Examples 8
|