id='header'>Press de button
I got bored :\
shout out to carter!
shout out to jason!
shout out to austin!
shout out to daniel! (had to add this myself :( )
good job
//init object globally
var objImage= null;
function init(){
objImage=document.getElementById("image1");
objImage.style.position='relative';
objImage.style.left='0px';
objImage.style.top='0px';
}
function getKeyAndMove(e){
var key_code=e.which||e.keyCode;
switch(key_code){
case 37: //left arrow key
moveLeft();
break;
case 38: //Up arrow key
moveUp();
break;
case 39: //right arrow key
moveRight();
break;
case 40: //down arrow key
moveDown();
break;
}
}
function moveLeft(){
objImage.style.left=parseInt(objImage.style.left)-5 +'px';
}
function moveUp(){
objImage.style.top=parseInt(objImage.style.top)-5 +'px';
}
function moveRight(){
objImage.style.left=parseInt(objImage.style.left)+5 +'px';
}
function moveDown(){
objImage.style.top=parseInt(objImage.style.top)+5 +'px';
}
function spin(object) {
setInterval(function() {
object.style.transform += "rotate(10deg)";
}, 1);
}
var context;
function init()
{
context= myCanvas.getContext('2d');
context.beginPath();
context.fillStyle="#0000ff";
// Draws a circle of radius 20 at the coordinates 100,100 on the canvas
context.arc(100,100,20,0,Math.PI*2,true); context.closePath();
context.fill();
}
var x = document.getElementById("myAudio");
function playAudio() {
x.play();
}
function pauseAudio() {
x.pause();
}
window.onload=init;
onkeydown='getKeyAndMove(event)'>