SEO | Link Popularity | Search Engine Consulting | SEO Tutorial | SEO Tools | SEO Forum
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-12-2005, 01:56 AM
huseyin_akturk huseyin_akturk is offline
SEO Junior
 
Join Date: Jun 2005
Posts: 1 huseyin_akturk is on a distinguished road
onkeyup and backspace key

Hi,
Firstly, I want to say I am new on javascript.
I want to remove backspace key. I mean that when user presses backspace key, I will prevent user to go back page. But user can press any part of the page, not speficific part. I thought that I can do this operation in body tag. And I wrote this code;
Code:
<body onkeyup="blockbackspace(this)">

And there is a javascript function;
Code:
function blockbackspace(n){
      if (event.keyCode == 8){
         ???? 
      }
}

As you see above, when user press backpace "if (event.keyCode == 8)" is true. But what should I do rest of this? Altough I wrote this javascript the back page is loaded. How can I prevent?
Reply With Quote
  #2  
Old 06-14-2005, 09:25 PM
SEO Aaron SEO Aaron is offline
SEO Guy Web dev team
 
Join Date: Feb 2005
Posts: 693 SEO Aaron is on a distinguished road
This seems to work.

<html>
<head>
<title>Remove Backspace</title>
<script type="text/javascript">
var allow_backspace = false;
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

function trapKeyPress(event)
{
if (!allow_backspace && keyCode == 8)
return false;
return true;

}
</script></head>
<body onkeydown="return trapKeyPress(event);" onkeypress="return trapKeyPress(event);">



</BODY>
</HTML>

I found it here....modified it a bit.

http://groups-beta.google.com/group...33b6bdc06b664f9

Last edited by SEO Aaron : 06-14-2005 at 10:20 PM.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Login/Register
User Name
Password
Remember Me?

Forum Links
Forum Home
SEO Forum
Internet Marketing Forum
Web Design Forum
Web Hosting Forum
Programming Forum
SEO Chat

Quick Links
Forum Home
New Posts
Mark Forums Read
Open Buddy List
User Control Panel
Edit Avatar
Edit Profile
Edit Options
Miscellaneous
Subscribed Threads
My Profile

Search Forums

Advanced Search
All times are GMT -8. The time now is 06:46 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.