The Essential Guide to HTML5

(Greg DeLong) #1

CHAPTER 3


Code Explanation


}


function change() {


ballvx = Number(f.hv.value);


ballvy = Number(f.vv.value);


return false;


}





<canvas id="canvas" width=
"400" height="300">


This browser doesn't support
the HTML5 canvas element.





<form name="f" id="f" onSubmit=
"return change();">


Horizontal velocity <input name=
"hv" id="hv" value="4" type=
"number" min="-10" max="10" />




Vertical velocity <input name=
"vv" id="vv" value="8" type=
"number" min="-10" max="10"/>


Free download pdf