tags:

views:

90

answers:

3

I have a popup div which has lot of controls. If i press on tab continiously the focus must not leave from the div to parent form.How to do this? Thanks

A: 

In the onblur event of the last control move the focus to the first control inside the div.

rahul
A: 

try using a modal div if you want to absolutely ensure that the focus doesn't leave.

Jason
+1  A: 

This is not possible to enforce in plain HTML.
There are however quite some scripts out there that take care of this for you. I would strongly suggest to use one of them as there are quite some problems that need to be addressed (A dropdown might appear in front of your modal div).

If you are using asp.net you can check out the ajax control toolkit which has a modal popup dialog.

Nearly every decent javascript framework has plugins to accomplish this aswell. I happen to work a lot with jQuery which has a number of plugins to handle this:

And if you find the need to make one yourself, here is a tutorial on how to do it using jQuery: http://www.queness.com/post/77/simple-jquery-modal-window-tutorial

Good luck with finding a solution that fits you best!

Peter