469,621 Members | 1,688 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

Enable/Disable enter key

hiiiiiiiiiii everybody,
pls solve my problem if u can?
Actualy what happens in my site when i press enter key it will show some secured information related to my site.So for that i have use this code to disable enter key:
Expand|Select|Wrap|Line Numbers
  1.        <script type="text/javascript" language="javascript">
  2.   /*-----script to disable F5 key begin-----*/
  3.     var version = navigator.appVersion;
  4.  
  5.      function showKeyCode(e)
  6.      {
  7.      var keycode =(window.event) ? event.keyCode : e.keyCode;
  8.  
  9.       if ((version.indexOf('MSIE') != -1))
  10.      {
  11.  
  12.      if((keycode == 13))
  13.      {
  14.      if(keycode == 13)
  15.      {
  16.  
  17.       event.keyCode = 0;
  18.      }
  19.      else
  20.      {
  21.       alert ("Sorry");
  22.      }
  23.      event.returnValue = false;
  24.      return false;
  25.      }
  26.      }
  27.      else
  28.      {
  29.      if((keycode == 13))
  30.      {
  31.      if(keycode == 13)
  32.       alert ("Sorry, Enter key is disabled.");
  33.      else
  34.       alert ("Sorry, ");
  35.      return false;
  36.      }
  37.      }
  38.      }
  39.  
  40.  
  41.    window.onload = function() {
  42.     document.onselectstart = function() {return false;} // ie
  43.     document.onmousedown = function() {return false;} // mozilla
  44.     }
  45.    /*-----script to disable text selectiong end----*/
  46.    javascript:window.history.forward(1);
  47.   </script>
  48.  
But now im using searching in my site n for that i want that afer entering text when i press enter key go button for searching has been clicked instead of seperatly clicking go button.
Please help.



Shikha
Dec 23 '08 #1
8 5173
Frinavale
9,735 Expert Mod 8TB
@alamodgal
Instead of disabling the Enter key, consider implementing code that keeps the secured information from displaying. What type of information is it?
Dec 23 '08 #2
hiiiiiiiii
actully im using isapi rewrite url for my site so that i can hide information of different pages like filename and fileid but one problem that i got is that when i just simply use enter key on my site.it will show that complete url of mine including filename and fileid so for that i have disable enter key by using this code.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" language="javascript">
  2.   /*-----script to disable F5 key begin-----*/
  3.     var version = navigator.appVersion;
  4.  
  5.      function showKeyCode(e)
  6.      {
  7.      var keycode =(window.event) ? event.keyCode : e.keyCode;
  8.  
  9.       if ((version.indexOf('MSIE') != -1))
  10.      {
  11.  
  12.      if((keycode == 13))
  13.      {
  14.      if(keycode == 13)
  15.      {
  16.  
  17.       event.keyCode = 0;
  18.      }
  19.      else
  20.      {
  21.       alert ("Sorry, Ctrl button is disabled.");
  22.      }
  23.      event.returnValue = false;
  24.      return false;
  25.      }
  26.      }
  27.      else
  28.      {
  29.      if((keycode == 13))
  30.      {
  31.      if(keycode == 13)
  32.       alert ("Sorry");
  33.      else
  34.       alert ("Sorry");
  35.      return false;
  36.      }
  37.      }
  38.      }
  39.  
  40.    /*-----script to disable F5 key end-----*/
  41.    /*window.onunload = function() {
  42.     alert('Sorry, page cannot be refreshed.');
  43.     return false;
  44.    }*/
  45.    /*-----script to disable text selectiong begin----*/
  46.    window.onload = function() {
  47.     document.onselectstart = function() {return false;} // ie
  48.     document.onmousedown = function() {return false;} // mozilla
  49.     }
  50.    /*-----script to disable text selectiong end----*/
  51.    javascript:window.history.forward(1);
  52.   </script>
  53.  
  54.  
but now for applying searching on my pages i have to enable enter key so that after entering text when i press enter key go button for searching has been clicked taht actully doesnt happen because of my previous code..


plsssssssss help.
Dec 24 '08 #3
Frinavale
9,735 Expert Mod 8TB
Hi Alamodgal,

Please do not double post your question. It makes it hard for you to get an answer to your problem. I have merged your questions into one thread.

In response to your question, have you seen this article? It covers how to "rewrite" the URL to hide any information displayed in the URL that you may want to keep hidden. I think this would be a better solution to what you're currently doing.

-Moderator Frinny
Dec 24 '08 #4
hiiiiiiiiiiiii
Actually i cant use anything else for url rewrite except isapi rewrite url.
Dec 29 '08 #5
Frinavale
9,735 Expert Mod 8TB
Are you using Helicon Tech's ISAPI Rewrite?
Dec 29 '08 #6
Yes,It is Helicon Rewrite Url
Dec 30 '08 #7
Frinavale
9,735 Expert Mod 8TB
From the research I've done on the topic, I've found that you are going to have to go through your page and rewrite the links so that the file information doesn't show up. Then you need to implement the ISAPI rewrite to translate the links so that the page can retrieve the file.

Check out this article because it contains a lot of information an in depth explanation on how to use Helicon Tech's ISAPI Rewrite. Also, use Helicon Tech Rewrite's Documentation as a reference for developing the url rewrite.
Dec 30 '08 #8
hiiiiiiiiiiii
I have already done url rewriting using this
Dec 31 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Derek White | last post: by
3 posts views Thread by Alphonse Giambrone | last post: by
reply views Thread by talal | last post: by
8 posts views Thread by rongchaua | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.