[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Please help me with the TAB character!

Posted on 2004-11-25
5
Medium Priority
?
1,283 Views
Last Modified: 2013-12-03
Hi there!
When you open notepad, and press the TAB button on the keyboard, it moves the cursor to some new place from its previous position (say 8 characters far from it). You can have the same effect when you press and hold Alt key, then type 09 and release all keys.
The same way, you can go to a new line, when you press the enter key, or when you type ALT+013 or ALT+010 (I know the difference of the last two.)
Now, go to the textarea right below here, where you can type an answer to my question!
The "Enter" button and ALT+013 are working correctly. ALT+010 is not working. I can suppose that I understand why it happens, though I can not understand it completely. But the main question is not that:
In the same textarea, if you press TAB key, you will be moved to the submit button; if you press ALT+09 it does not move the cursor; but if you copy and paste that empty space created by pressing TAB key in notepad area, you can have the same space inside the text area!
I want a way to create a same effect when typing inside a text area, without having to copy and paste this TAB-made space from another source.
Thanks
Shablon
0
Comment
Question by:Shablon
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:mosphat
ID: 12675328
Something like this?

<html>
    <head>
        <script>
            function trapTab(textarea) {
                if (window.event.keyCode == 9) {
                    textarea.value += '\t';
                    textarea.focus();
                    return false;
                }
            }
        </script>
    </head>
    <body>
        <form>
            <textarea onkeydown="return trapTab(this);"></textarea>
        </form>
    </body>
</html>
0
 

Author Comment

by:Shablon
ID: 12675448
Oops!! You have given me an excellent answer, but this is not my question!!
I am not going to create a page in which people can use TAB key with it's space creating action! I am not going to create a page at all! I am just looking for a way to be used by me myself as a USER (not a designer) to type a TAB character inside any text area!
Example: I want to post some code here. I want to type it inside the "Post a OCmment" textarea right now. I want to use TAB character too. What keys should I press then?
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 750 total points
ID: 12676105
Not gonna happen.  The tab key by default is used to traverse the inputs.  Unless the developers put scripting on a page to alter that behaviour that is what the browser is going to do.  The cut an paste of the tab character is the only way you are going to get it in there.  Perhaps you can setup one of your function keys to generate it from the clipboard.  I'm not sure if it will be stripped on the server or not.  So even if you put it in it may not show up when the comment is displayed on the page anyway.

Cd&
0
 

Author Comment

by:Shablon
ID: 12676785
Excuse me for asking this again, but, I can accept that the TAB key is designed to move us to the next item in IE and other browsers, but why ALT+09 does exactly NOTHING? It neither creates that space nor moves to the next object in the page!
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12676886
Because whomever wrote the specifications decided to do it that way. I see no practical value in researching why they did it or who did it.  At best it is an answer to a trivia question, and my time can be put to more productive pursuits.

Cd&
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question