Term Paper - Applying Javascript
Term Paper - Applying Javascript
and was designed to have a similar look to Java, but be easier for non-
programmers to work with. The language is best known for its use in
and JavaScript copies many Java names and naming conventions. The
runtime with their browser, which was dominant at the time. The key
programming language.
code can simply be embedded within the XHTML code of the web page
scripting language.
still have the ability to use the same language on the server-side that
interpreted, so you can write it once and let the execution environment
interpret it.
Demonstrating a basic syntax for OO; you can use this syntax
keyword together with the function gives you new instances of the
// a Person class
function Person (sName, nAge) {
this.sName = sName;
this.nAge = nAge;
}
That's all there is too it. You have now defined a class (Person),
with one method (tellMe).
Using the Object - to use the Person class we just defined:
var oPerson = new Person("Bob", 28);
alert (oPerson.tellMe());
long as the string actually contains a number and not something like
fine, too.
One could also say that the forgiving nature of JavaScript is one
of the worst aspects of the language. If you try to add two numbers
together, but the JavaScript engine interprets the variable holding one
of them as a string data type, you end up with an odd string, rather
and also when it comes to working with the most basic of JavaScript
This chapter covers the three basic JavaScript data types: string,
boolean, and number. Along the way, we'll explore escape sequences
in strings and take a brief look at Unicode. The chapter also delves into
the topic of variables, including variable scope and what makes valid
Identifying Variables
_variableidentifier
variableIdentifier
$variable_identifier
var-ident
Starting with JavaScript 1.5, you can also use Unicode letters
_üvalid
T\u0009
Expressions
"234"
that have not been assigned a value are undefined, and cannot be
Conditional Expressions
has the value of val2. You can use a conditional expression anywhere
For example,
status = (age >= 18) ? "adult" : "minor"
two loop structures: for and while. In addition, the break and
Java for loop and the traditional for loop in C. A for statement
looks as follows:
follows:
while (condition) {
statements
}
5. Break Statement - The break statement terminates the current
break statement that terminates the while loop when i is 3, and then
HTML gives you the possibility to split the window of the browser
into several frames. Each of these frames forms a window of its own
I use frames on this site: I split up the browser window in which you've
loaded this site into three frames: the logo frame above, the navigation
JavaScripts to each of these pages and they will work inside that page.
You can also write scripts that influence other frames or even other
browser windows, for instance loading new pages into the frame, or
You can use this name both in HTML and in JavaScript. HTML has the
TARGET attribute with which you can specify the frame in which a page
should be loaded:
all open frames and windows for the frame with name content and
the names of all the frames, but naming the name only is not enough:
you should also specify where in the frame tree the frame is.
When you create frames, you also create a frame tree. Each frame is
loaded inside another frame or inside the top window, and when you
use cross-frame JavaScript, you'll have to specify the path that leads to
the frame you want to influence. So first of all you need to understand
the frame tree. At the top of the frame tree there's always the window
in which the frames are opened, JavaScript calls this frame top. And
know of its uses. This not only for a gaming programs but also like any