mashraf
06-21-2003, 09:07 PM
Hi every on,
I want to have functionality on a page that if user presse any key he/she can go to previous page. The follwoing script does that however there is one problem. It also goes back when user press page up/down, arrow up/down. Some one plese tell me how that could be ignored:
<script type="text/javascript">
function keyUP(e){
var trigger = (document.all)?event:e;
keyValue = String.fromCharCode(trigger.keyCode);
history.go(-1);
}
if(!document.all){
document.captureEvents(Event.KEYUP);
}
document.onkeyup = keyUP;
</script>
I tried the following but it does not work:
<script type="text/javascript">
function keyUP(e){
var trigger = (document.all)?event:e;
keyValue = String.fromCharCode(trigger.keyCode);
VAR KEYVAL = "R";
IF ( keyValue == KEYVAL)
{
history.go(-1);
}
}
if(!document.all){
document.captureEvents(Event.KEYUP);
}
document.onkeyup = keyUP;
</script>
I want to have functionality on a page that if user presse any key he/she can go to previous page. The follwoing script does that however there is one problem. It also goes back when user press page up/down, arrow up/down. Some one plese tell me how that could be ignored:
<script type="text/javascript">
function keyUP(e){
var trigger = (document.all)?event:e;
keyValue = String.fromCharCode(trigger.keyCode);
history.go(-1);
}
if(!document.all){
document.captureEvents(Event.KEYUP);
}
document.onkeyup = keyUP;
</script>
I tried the following but it does not work:
<script type="text/javascript">
function keyUP(e){
var trigger = (document.all)?event:e;
keyValue = String.fromCharCode(trigger.keyCode);
VAR KEYVAL = "R";
IF ( keyValue == KEYVAL)
{
history.go(-1);
}
}
if(!document.all){
document.captureEvents(Event.KEYUP);
}
document.onkeyup = keyUP;
</script>