• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

disabling backspace for the browser

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i an application for taking online examination using jsp and orcle,
the person taking the exam gets questions on different pages.After he has answered one question he cannot come back to the previous question.for that the backspace key needs to be disabled.please help me in getting this thing done.
send me the detailed code...
Thanking you....
urvi
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
location.replace()disables browser-back-button, back in contextmenu and backspace as it overwrites the actual entry in the browsers history. Maybe there's a better way ( e.g. waiting 4 Eric Pascarello ), but here is an example that might help you:

cb
 
Ranch Hand
Posts: 687
Hibernate jQuery Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i use this function hope it helps..
document.onkeydown = mykeyhandler;
function mykeyhandler() {
if (window.event && window.event.keyCode == 8) {
// try to cancel the backspace
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even if you disable the backspace key, that won't solve your problem. There are too many ways to navigate back to a previous page, and in many browsers hitting backspace isn't even one of them. (The truth is, I didn't know there were any browsers in which backspace does that!)
There are several ways in JSP to prevent earlier information from being shown again. One is to have a session variable that controls which question is being presented, and is incremented each time an answer is submitted. Since all the questions are being presented in the same page, and the URL doesn't change, browser navigation functions won't allow going back to an earlier question.
This won't stop them from starting all over with a clean slate. You'll need to keep some kind of persistent record on each person to monitor that.
 
urvi patel
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks For ur. answeres...
urvi
 
reply
    Bookmark Topic Watch Topic
  • New Topic