Please help me with the TAB character!

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Something like this?

            function trapTab(textarea) {
                if (window.event.keyCode == 9) {
                    textarea.value += '\t';
                    return false;
            <textarea onkeydown="return trapTab(this);"></textarea>
ShablonAuthor Commented:
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?
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.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShablonAuthor Commented:
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!
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.