My goal is to create a functionality where an image moves in response to arrow key commands, using CSS.
This is the approach I am considering:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<script>
function moveImage() {
// k is set as a global variable but unsure of how to declare it
document.getElementById("img1").style.top = k + "px";
k++;
// Also struggling with triggering the function using 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>