Javascript
you can 'mix' html and javascript on same page
(javascript)
(javascript)
Another javascript example:
A JavaScript Example
For older browsers, you may need to prepare for the inability to process javascript
This hides the script from the browser if it is not able to process that script language
In JavaScript:
x = 0 =>this is a global variable, with a scope of the entire document
var x = 0;
{ (function) } => this has local scope
Control structures in JavaScript, (a lot like C++)
if(condition) {
statements for true
}
else {
statements for false
}
for(initExpr; condition; incrExpr) {
statements to execute
}
EXAMPLE;
for(x=1; x<=10; x++) {
y = x * 25;
document.write("x=" + x + "
" + "y=" + y + "
");
}
'while', 'continue' and 'break' are also like C++
CIS525 - Lecture#7 - September 25, 2000
Objects in Javascript - created can be similar to objects in C++, with some differences
this.firstname = firstname; => accessing and assigning
An Object Example:
An Object Example