Physics and Engineering 2016
Reach Cambridge
BASIC HTML PAGE
<HTML>
<HEAD>
<TITLE>
Title Here
</TITLE>
<STYLE>
canvas {width: 100%; height: 100%}
</STYLE>
</HEAD>
<BODY>
<SCRIPT>
//Code here
</SCRIPT>
</BODY>
</HTML>
var
The var key is short for variable. A variable is a command that can
change
Math in HTML Code
[Link].x = [Link]/6;
[Link].y = [Link] ( ) * 0.0049
Booleans
true/false
var yes = true;
Strings
Caracters
var str1 = something
var str 2 = bob
str1+ + str2
//Something bob
var str = The answer to 7 + 4 is ;
var answer = 11
//7+4
Repeating and Skipping Code
[Link](keydown,function(event){var code =
event;keyCode;
1) if (code==32) pushCar(); // space
2) else if (code ==37) rotateCar(-1); //left
Listing things
var amazing_movies = [
Star Wars,
Name of movie,
Structure of the code
<html>
<head>
<title>
Title for my program
</title>
<style>
canvas { width: 100%; height: 100% }
</style>
</head>
<body>
<script
src="//[Link]/ajax/libs/[Link]/r50/[Link]">
</script>
<script>
</script>
</body>
</html>