HTML and CSS Reference
In-Depth Information
Code
Explanation
}
Close clause
if (nbally < inboxboundy) {
Is the y value less than the top boundary?
nbally = inboxboundy;
If so, set the y value to be exactly the boundary
ballvy = -ballvy;
Change the vertical displacement
}
Close clause
ballx = nballx;
Set the x position to
nballx
bally = nbally;
Set the y position to
nbally
}
Close
moveandcheck
function
function change() {
Start of
change
function
ballvx = Number(f.hv.value);
Convert input to number and assign to
ballvx
ballvy = Number(f.vv.value);
Convert input to number and assign to
ballvy
return false;
Return
false
to make sure there isn't a page reload
}
Close function
</script>
Close script
</head>
Close head
Start
body
element. Set up call to
init
function
<body onLoad="init();">
<canvas id="canvas" width=
"400" height="300">
Start of
canvas
element
Your browser doesn't support the
HTML5 element canvas.
Message for non-compliant browsers
</canvas>
Close
canvas
element
<br/>
Line break