04-15-2011, 01:12 PM
I see your point...
Well this is how I would do it with ordinary javascript.
In this script you need to remember, the javascript code needs to be loaded in every other file that your redirect the user to, and you need to update the page variable with PHP for example, or simply assign the right number to it in every file.
Well this is how I would do it with ordinary javascript.
Code:
<!DOCTYPE html>
<head>
<title>{$TITLE}</title>
<link rel="stylesheet" type="text/css" href="style/main.css" />
<script src="http://code.jquery.com/jquery-1.5.js" type="text/javascript"></script>
<script type="text/javascript">
var pages = {
0:"index.htm",
1:"1.php",
2:"2.php",
3:"3.php",
4:"4.php",
};
var page = 0;
function keydown(e)
{
e = (e) ? e : window.event;
var key = (e.charCode) ? e.charCode : e.keyCode;
if(key == 37)
{
page = (page > 0) ? (page - 1) : 0;
}
else if(key == 39)
{
page = (page < 4) ? (page + 1) : 4;
}
window.location = pages[page];
}
</script>
<!--[if IE 8]><link rel="stylesheet" href="style/ie.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="style/ie.css" /><![endif]-->
<!--[if IE 6]><link rel="stylesheet" href="style/ie.css" /><![endif]-->
</head>
<body onload="" onkeydown="keydown(event)">
</body>
</html>
In this script you need to remember, the javascript code needs to be loaded in every other file that your redirect the user to, and you need to update the page variable with PHP for example, or simply assign the right number to it in every file.