Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - TAB-key support
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedTAB-key support

 Post Reply Post Reply
Author
delpierro View Drop Down
Newbie
Newbie


Joined: 16 October 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote delpierro Quote  Post ReplyReply Direct Link To This Post Topic: TAB-key support
    Posted: 16 October 2007 at 10:53pm
I'm trying to get the Tab-key working for this textarea but without any luck.
Maybe because this textarea is in a iframe???
 
(this sample uses CTRL-TAB)
 
 
 
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2007 at 8:05am
The example you link to doesn't do anything, at least in my browser, it just jumps to the bottom of the page when I hit the TAB key.

In the Web Wiz RTE if you hit TAB it leaves a TAB ie:-

       This is tabbed text         another two tabs on.
Back to Top
delpierro View Drop Down
Newbie
Newbie


Joined: 16 October 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote delpierro Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2007 at 4:31pm
try CTRL-TAB
 
 
 
code:
if ((document.all) && (9==event.keyCode) && (event.ctrlKey)) {
 
can be changed to:
 
if ((document.all) && (9==event.keyCode)) {
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2007 at 4:54pm
Even in the example you link to CTRL -> TAB just changes between the TABs in the browser at the top of the screen.

It looks like some old code for IE 4, so doesn't seem to work in new browsers with TAB's so not sure what it's meant to do.
Back to Top
delpierro View Drop Down
Newbie
Newbie


Joined: 16 October 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote delpierro Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2007 at 7:34pm

above example works for me with IE6, but there is another example at:

http://www.webdeveloper.com/forum/showthread.php?t=32317&page=3
this works with IE6 and FireFox
 
code:
 
<html>
<head>
<script type="text/javascript">
function setSelectionRange(input, selectionStart, selectionEnd) {
  if (input.setSelectionRange) {
    input.focus();
    input.setSelectionRange(selectionStart, selectionEnd);
  }
  else if (input.createTextRange) {
    var range = input.createTextRange();
    range.collapse(true);
    range.moveEnd('character', selectionEnd);
    range.moveStart('character', selectionStart);
    range.select();
  }
}
function replaceSelection (input, replaceString) {
 if (input.setSelectionRange) {
  var selectionStart = input.selectionStart;
  var selectionEnd = input.selectionEnd;
  input.value = input.value.substring(0, selectionStart)+ replaceString + input.value.substring(selectionEnd);
   
  if (selectionStart != selectionEnd){
   setSelectionRange(input, selectionStart, selectionStart +  replaceString.length);
  }else{
   setSelectionRange(input, selectionStart + replaceString.length, selectionStart + replaceString.length);
  }
 }else if (document.selection) {
  var range = document.selection.createRange();
  if (range.parentElement() == input) {
   var isCollapsed = range.text == '';
   range.text = replaceString;
    if (!isCollapsed)  {
    range.moveStart('character', -replaceString.length);
    range.select();
   }
  }
 }
}

// We are going to catch the TAB key so that we can use it, Hooray!
function catchTab(item,e){
 if(navigator.userAgent.match("Gecko")){
  c=e.which;
 }else{
  c=e.keyCode;
 }
 if(c==9){
  replaceSelection(item,String.fromCharCode(9));
  setTimeout("document.getElementById('"+item.id+"').focus();",0); 
  return false;
 }
     
}
</script>
</head>
<body>
<form>
<textarea name="data" id="data" rows="20" columns="35" wrap="off" onkeydown="return catchTab(this,event)" ></textarea>
<input type="submit" name="submit" value="Submit"/>
</form>
</html>
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2007 at 7:38pm
I still don't know what you are trying to archive?

In the RTE the TAB key works as a TAB key, creating tabbed spaces between words or letters.
Back to Top
delpierro View Drop Down
Newbie
Newbie


Joined: 16 October 2007
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote delpierro Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2007 at 8:34pm
Originally posted by -boRg- -boRg- wrote:

I still don't know what you are trying to archive?

In the RTE the TAB key works as a TAB key, creating tabbed spaces between words or letters.
 
Do you realy mean that?
 
This is not working for me.  I got the latest version (free demo)
I'am using IE6.
 
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2007 at 10:25am
OK I see now what you are doing. Although Firefox, Opera, Netscape, Mozilla, Netwscape, etc. support using Tabbed spaces, in IE once it's built in RTE API is enabled there isn't away to catch the Tab key being pressed. All the usual techniques, such as keypress, keyCode, etc. do not work.

Edited by -boRg- - 18 October 2007 at 10:26am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.