Jump to content

Code which stopped working in FF


Spectre

Recommended Posts

Hey guys and gals,

 

I've got some code on a game I code for, nice and simple, it's just something as extra control of a navigation system. Simple thing, checks for a certain keypress, each key in the list will output a line into the URL to navigate.

 

?>

<script language="javascript">
function getArrows(event) {
arrows=((event.which)||(event.keyCode));
switch(arrows) {

	case 37:
		action = 'left';
		break;

	case 38:
		action = 'up';
		break;

	case 39:
		action = 'right';
		break;

	case 40:
		action = 'down';
		break;

	case 100:
		action = 'left';
		break;

	case 104:
		action = 'up';
		break;

	case 102:
		action = 'right';
		break;

	case 98:
		action = 'down';
		break;

        case 97:
		action = 'downleft';
            break;

	case 99:
		action = 'downright';
            break;

	case 103:
		action = 'upleft';
		break;

	case 105:
		action = 'upright';
            break;


}
window.location.href = "/quest.php?action="+action;
}
</script>

<body onkeydown="getArrows(event)">

<?

 

Now that's been working fine since I put it in like 2 years back?

But suddenly it seems to not like to work in FF, a few users have reported this, mine was fine a few days back, but suddenly now is also spazzing, I believe since FF updated (i've had it open for weeks so it's not had chance until the other day to update to latest version).

 

Any advice would be greatly appreciated, the navigation takes place on an grid from 0-80 on both axis, and the use of keyboard is much easier than clicking with mouse etc, so would really like to fix things >_<

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.