Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Tab key inside div

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rodchar - 19 Dec 2007 15:16 GMT
hey all,
is it possible to simulate the Tab key inside a Div element?

thanks,
rodchar
Mark Rae [MVP] - 19 Dec 2007 15:56 GMT
> is it possible to simulate the Tab key inside a Div element?

Not sure what you mean...

The Tab key will set focus to the next editable element horizontally then
vertically - is this not what you want...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

rodchar - 19 Dec 2007 17:01 GMT
no, i mean tab over spaces.

> > is it possible to simulate the Tab key inside a Div element?
>
> Not sure what you mean...
>
> The Tab key will set focus to the next editable element horizontally then
> vertically - is this not what you want...?
Mark Rae [MVP] - 19 Dec 2007 17:52 GMT
>> > is it possible to simulate the Tab key inside a Div element?
>>
[quoted text clipped - 4 lines]
>
> no, i mean tab over spaces.

Explain, please...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Mohamad Elarabi - 20 Dec 2007 03:21 GMT
Not exactly an ASP.Net question but here is my response:

You can try placing a OnKeyPress or an OnKeyDown event on the div and have
them call a js function.

Your function should check the value of event.keyCode to see if tab was
pressed or not. I think the keycode for tab is 8 but I could be wrong. If it
is tab then append 4 or 8 spaces to the div's innerHTML/innerText etc then
make sure to return false and cancel event bubbling so the browser won't tab
to the next control.

Something like this

<div id="blah" onKeyPress="doTab;"></div>

<script language="jscript">
function doTab()
{
  if event.keyCode == 8
  {
     document.all.item("blah").innerHTML += "   ...";
     event.returnValue = false;
     event.cancelBubble = true;
   };
}

</script>

Hope that works for you.

Signature

Mohamad Elarabi
Lead Developer. MCTS, MCPD.

> hey all,
> is it possible to simulate the Tab key inside a Div element?
>
> thanks,
> rodchar
rodchar - 20 Dec 2007 19:01 GMT
thanks for the help everyone.
rod.

> Not exactly an ASP.Net question but here is my response:
>
[quoted text clipped - 31 lines]
> > thanks,
> > rodchar

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.