On 3/17/06, Meenakshi Singh <[EMAIL PROTECTED]> wrote: > Just for curiosity, I tested this code snippet in IE. However, it does > nothing. > Is there anything else that needs to be done.
well you need a table with the id="mytable".. And you need to set the rowAdded variable, so in the AddRowAction you could set a request attribute or pass a parameter.. request.setAttribute("rowAdded","true"); and then in jsp var rowAdded = "${rowAdded}"; this means the focus will only happen if that action has been executed.. It works in firefox and safari, and i dont like firing up my pc as is noisey and i feel dirty doing it.. But i think that offsetTop will be supported.. Mark > > Thanks & Regards, > MS > > -----Original Message----- > From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 16, 2006 9:29 PM > To: Struts Users Mailing List > Cc: Struts Users Mailing List > Subject: Re: [OT] Re: Set focus on a table on page load. > > > > On Thu, March 16, 2006 10:39 am, Dave Newton said: > > Anjishnu Bandyopadhyay wrote: > >> Actually, it is a table where rows can be added/deleted. > >> So, after, addition/deletion of a row, (on page load) focus is to be set > >> to the table. > >> > > > > I'm not convinced you can set focus on a non-input item; that really > > wouldn't make any sense. > > I think you actually can, at least in IE (I was a bit surprised by this). > Quick test: > > <html><head><title></title></head> > <body onLoad="document.getElementById('myCell').focus();"> > <table> > <tr> > <td id="myCell" onKeyDown="alert('hello');">My cell</td> > <td id="myCell2" onKeyDown="alert('hello2');">My cell2</td> > </tr> > </table> > </body></html> > > Note that if you load this in IE and just press Return, the onKeyDown > handler of the first cell fires. Further, click the second cell and click > Return. Again, the handler for *that* cell fires, indicating focus went > to the cell. > > This DOES NOT seem to work in Firefox though, at least when I tried it, so > it certainly doesn't seem to be cross-browser. Still, interesting :) > > > I believe you'll need to set focus on a user-input control. > > > > Dave > > Frank > > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > AIM: fzammetti > Yahoo: fzammetti > MSN: [EMAIL PROTECTED] > Java Web Parts - > http://javawebparts.sourceforge.net > Supplying the wheel, so you don't have to reinvent it! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]