
previous

page 15
next
I've introduced you to a lot of JavaScript.
Now would be a good time to review what I've covered.
Functions
alert, setTimeout, getAttribute
Other Important Stuff
this, variables, if statement, own functions, %
Examples
var card1='';
function card_clicked(image) {
var n=image.getAttribute('n');
image.src='cards/'+n+'.png';
if (card1=='') {
card1=image;
} else {
var n1=card1.getAttribute('n');
n1=n1%13;
if (n1==n2) {
setTimeout(clear,1000,card1);
}
card1='';
}
}
function clear(image) {
image.src='cards/0.png';
}
function card_clicked(image) {
var n=image.getAttribute('n');
image.src='cards/'+n+'.png';
if (card1=='') {
card1=image;
} else {
var n1=card1.getAttribute('n');
n1=n1%13;
if (n1==n2) {
setTimeout(clear,1000,card1);
}
card1='';
}
}
function clear(image) {
image.src='cards/0.png';
}
There's no point in moving on until you're totally comfortable with all the ideas on this page.
previous
next