will this sort of thing do?

window.onload = function() {
  if(rowAdded) {
        var table = document.getElementById("mytable");
       tableFocus(table);
 }
}

function tableFocus(table) {
        window.scroll(0,table.offsetTop);
        table.style.borderColor = "#f00";
        table.style.borderStyle = "solid";
        table.style.borderWidth = "1px";
       rowAdded = false;
}


On 3/16/06, Mark Lowe <[EMAIL PROTECTED]> wrote:
> If i've understood the problem, rather than trying to focus on the
> table you could create the illusion.. You'd need to get a where the
> table is on the page and perhaps apply some styles to the table. If
> you cant get the position of the table then an anchor will do.. Just
> scroll the window to that.
>
> document.getElementById("mytable").offsetTop
>
> works on firefox and safari.. dont know about ie..
>
> Mark
>
> On 3/16/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> >
> > 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]

Reply via email to