elwell
08-04-2003, 03:08 PM
I been going through and trying different numbers to find out which key is which number, but it takes so long to find each one out. Can someone please tell what numbers the four arrowkeys are for IE and Netscape (More importantly IE). Or maybe a Chart of all of them that you found on the web. I have highlited the part of my script where i need to know this info for clarity:
<html>
<HEAD><title>Skateboarder</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
n = (document.layers) ? 1 : 0;
ie = (document.all) ? 1 : 0;
function moveImage() {
if (n) {
block = document.blockDiv;
}
if (ie) {
block = blockDiv.style;
}
block.xpos = parseInt(block.left);
block.ypos = parseInt(block.top);
block.active = 0;
document.onkeydown = keyDown;
document.onkeyup = keyUp;
if (n) {
document.captureEvents(Event.keydown | Event.keyup);
}
}
function keyDown(e) {
if (n) {
var nKey = e.which;
var ieKey = 0;
}
if (ie) {
var ieKey = event.keyCode;
var nKey = 0;
}
if ((nKey == 97 || ieKey == 65) && !block.active) {
block.active = 1;
slideLeft();
}
if ((nKey == 99 || ieKey == 72) && !block.active) {
block.active = 1;
slideRight();
}
if ((nKey == 80 || ieKey == 68) && !block.active) {
block.active = 1;
slideDown();
}
if ((nKey == 89 || ieKey == 79) && !block.active) {
block.active = 1;
slideUp();
}
}
function keyUp(e) {
if (n) {
var nKey = e.which;
var ieKey = 0;
}
if (ie) {
var ieKey = event.keyCode;
var nKey = 0;
}
if ((nKey == 97 || ieKey == 65 || nKey == 99 || ieKey == 72 || nKey == 80 || ieKey == 68 || nKey == 89 || ieKey == 79 ))
block.active = 0;
}
function slideRight() {
if (block.active) {
block.xpos += 10;
block.left = block.xpos;
setTimeout("slideRight()", 10);
}
}
function slideLeft() {
if (block.active) {
block.xpos -= 10;
block.left = block.xpos;
setTimeout("slideLeft()", 10);
}
}
function slideDown() {
if (block.active) {
block.ypos += 10;
block.top = block.ypos;
setTimeout("slideDown()", 10);
}
}
function slideUp() {
if (block.active) {
block.ypos -= 10;
block.top = block.ypos;
setTimeout("slideUp()", 10);
}
}
// End -->
</script>
</HEAD>
<BODY OnLoad="moveImage()">
<div id="blockDiv" STYLE="position:absolute; left:100px; top:100px; width:137px; height: 121px; z-index:50;">
<img src="skater.gif" width="39" height="59"></div>
<span style="position: absolute; top:100px; left:200px;"><img src="grindsetup.gif" width="274" height="51">
</span>
</body>
</html>
<html>
<HEAD><title>Skateboarder</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
n = (document.layers) ? 1 : 0;
ie = (document.all) ? 1 : 0;
function moveImage() {
if (n) {
block = document.blockDiv;
}
if (ie) {
block = blockDiv.style;
}
block.xpos = parseInt(block.left);
block.ypos = parseInt(block.top);
block.active = 0;
document.onkeydown = keyDown;
document.onkeyup = keyUp;
if (n) {
document.captureEvents(Event.keydown | Event.keyup);
}
}
function keyDown(e) {
if (n) {
var nKey = e.which;
var ieKey = 0;
}
if (ie) {
var ieKey = event.keyCode;
var nKey = 0;
}
if ((nKey == 97 || ieKey == 65) && !block.active) {
block.active = 1;
slideLeft();
}
if ((nKey == 99 || ieKey == 72) && !block.active) {
block.active = 1;
slideRight();
}
if ((nKey == 80 || ieKey == 68) && !block.active) {
block.active = 1;
slideDown();
}
if ((nKey == 89 || ieKey == 79) && !block.active) {
block.active = 1;
slideUp();
}
}
function keyUp(e) {
if (n) {
var nKey = e.which;
var ieKey = 0;
}
if (ie) {
var ieKey = event.keyCode;
var nKey = 0;
}
if ((nKey == 97 || ieKey == 65 || nKey == 99 || ieKey == 72 || nKey == 80 || ieKey == 68 || nKey == 89 || ieKey == 79 ))
block.active = 0;
}
function slideRight() {
if (block.active) {
block.xpos += 10;
block.left = block.xpos;
setTimeout("slideRight()", 10);
}
}
function slideLeft() {
if (block.active) {
block.xpos -= 10;
block.left = block.xpos;
setTimeout("slideLeft()", 10);
}
}
function slideDown() {
if (block.active) {
block.ypos += 10;
block.top = block.ypos;
setTimeout("slideDown()", 10);
}
}
function slideUp() {
if (block.active) {
block.ypos -= 10;
block.top = block.ypos;
setTimeout("slideUp()", 10);
}
}
// End -->
</script>
</HEAD>
<BODY OnLoad="moveImage()">
<div id="blockDiv" STYLE="position:absolute; left:100px; top:100px; width:137px; height: 121px; z-index:50;">
<img src="skater.gif" width="39" height="59"></div>
<span style="position: absolute; top:100px; left:200px;"><img src="grindsetup.gif" width="274" height="51">
</span>
</body>
</html>