im new to html and im trying to make an image move on my command (the arrow keys), using the css.
i thought about this:
<html xmlns="http://ift.tt/lH0Osb">
<head runat="server">
<title></title>
</head>
<script>
function a() {
// k is a global variable but i dont know how to declare it
document.getElementById("img1").style.top = k + "px";
k++;
// and also i dont know how to trigger the function using the arrow keys
}
</script>
<body>
<form id="form1" runat="server">
<div>
<img id="img1" src="IMAGES/logo.jpg" height="100" width="100"
style="position:absolute; left:100px; top:100px; z-index:1" />
</div>
</form>
</body>
</html>
please help me :) thank you all
Aucun commentaire:
Enregistrer un commentaire