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
https://forums.phpfreaks.com/topic/254638-code-which-stopped-working-in-ff/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.