Is it possible to set focus to a table cell?

  • Follow


Hi!

I have a scrollable css table cell thing going on, and would like to
set the initial page focus to that cell in order that scrolling up and
down with the cursor keys (or mouse scroll wheel even) will scroll that
table cell rather than the html page.

The page in question is here: http://test.jonathanmortimer.co.uk/other/

Any help is much appreciated!  All I've managed to find so far is focus
on form fields, I don't even know if focus on table cells is possible
but I'd have thought it should be.

0
Reply jonny_morrisuk (6) 6/12/2006 11:42:07 AM

jonny_morrisuk@yahoo.co.uk wrote:

> Hi!
> 
> I have a scrollable css table cell thing going on, and would like to
> set the initial page focus to that cell in order that scrolling up and
> down with the cursor keys (or mouse scroll wheel even) will scroll that
> table cell rather than the html page.
> 
> The page in question is here: http://test.jonathanmortimer.co.uk/other/
> 
> Any help is much appreciated!  All I've managed to find so far is focus
> on form fields, I don't even know if focus on table cells is possible
> but I'd have thought it should be.

Hi,

Just an idea (without looking into your code):
You can maybe use a good old anchortag in your table at the right spot, and 
go to there?

<a name="comehere"></a>

Now for JS, on some event:
location.hash = "comehere";

Regards,
Erwin Moller
0
Reply Erwin 6/12/2006 12:10:36 PM


> You can maybe use a good old anchortag in your table at the right spot, and
> go to there?
>
> <a name="comehere"></a>
>
> Now for JS, on some event:
> location.hash = "comehere";

Thankyou!  That certainly put me on the right track.  I'd got as far as
the anchor tag but when it comes to onload and all that stuff I didn't
have a clue (I really should get a pocket reference book on it, any
recommendations?  I really like the CSS Pocket Reference from O'Reilly
which I have for CSS stuff)

My complete solution was this:


In the <head> section:

<script type="text/javascript">
 		  window.onload=function() {location.hash = "top"}
 </script>


and further down, in my css-scrollable table cell:

<h2><a name="top">The Money Pit</a></h2>

Hurray! :D

0
Reply Jonathan 6/13/2006 8:32:10 AM

Jonathan wrote:

> 
>> You can maybe use a good old anchortag in your table at the right spot,
>> and go to there?
>>
>> <a name="comehere"></a>
>>
>> Now for JS, on some event:
>> location.hash = "comehere";
> 
> Thankyou! 

Glad to be of help. :-)

 That certainly put me on the right track.  I'd got as far as
> the anchor tag but when it comes to onload and all that stuff I didn't
> have a clue (I really should get a pocket reference book on it, any
> recommendations?  I really like the CSS Pocket Reference from O'Reilly
> which I have for CSS stuff)

I would absolutely advise the fat book of O'Reilly, AKA the bible:
Javascript, The definite Guide 4th edition.

It is THE reference and also serves as a great learningbook.
Hence it's fatness. ;-)

> 
> My complete solution was this:
> 
> 
> In the <head> section:
> 
> <script type="text/javascript">
>  window.onload=function() {location.hash = "top"}
>  </script>
> 
> 
> and further down, in my css-scrollable table cell:
> 
> <h2><a name="top">The Money Pit</a></h2>
> 
> Hurray! :D

Good job.
:-)

Regards,
Erwin Moller
0
Reply Erwin 6/13/2006 8:47:24 AM

> I would absolutely advise the fat book of O'Reilly, AKA the bible:
> Javascript, The definite Guide 4th edition.

Hmm, I will look out for it but only if it's not too expensive :/


> > In the <head> section:
> >
> > <script type="text/javascript">
> >  window.onload=function() {location.hash = "top"}
> >  </script>
> >
> >
> > and further down, in my css-scrollable table cell:
> >
> > <h2><a name="top">The Money Pit</a></h2>

Ack!  Just discovered this doesn't work in Firefox (or Safari).  I
don't suppose you could suggest any tweaks I could try?  I'm pretty
much lost with all this javascript stuff without a book.

0
Reply Jonathan 6/13/2006 11:36:31 AM


> Ack!  Just discovered this doesn't work in Firefox (or Safari).  I
> don't suppose you could suggest any tweaks I could try?  I'm pretty
> much lost with all this javascript stuff without a book.

Correction: it *does* work in Firefox (1.5.0.2 on the Mac) but not
Safari, so I still need to sort this out - anyone know why it wouldn't
work in Safari?  Can someone try this in IE on Windows for me too? :D

0
Reply Jonathan 6/13/2006 12:41:07 PM

For pocket references, I use the Visibone pocket references at
www.visibone.com.  Their are free online charts on the site.




Erwin Moller wrote:
> Jonathan wrote:
>
> >
> >> You can maybe use a good old anchortag in your table at the right spot,
> >> and go to there?
> >>
> >> <a name="comehere"></a>
> >>
> >> Now for JS, on some event:
> >> location.hash = "comehere";
> >
> > Thankyou!
>
> Glad to be of help. :-)
>
>  That certainly put me on the right track.  I'd got as far as
> > the anchor tag but when it comes to onload and all that stuff I didn't
> > have a clue (I really should get a pocket reference book on it, any
> > recommendations?  I really like the CSS Pocket Reference from O'Reilly
> > which I have for CSS stuff)
>
> I would absolutely advise the fat book of O'Reilly, AKA the bible:
> Javascript, The definite Guide 4th edition.
>
> It is THE reference and also serves as a great learningbook.
> Hence it's fatness. ;-)
>
> >
> > My complete solution was this:
> >
> >
> > In the <head> section:
> >
> > <script type="text/javascript">
> >  window.onload=function() {location.hash = "top"}
> >  </script>
> >
> >
> > and further down, in my css-scrollable table cell:
> >
> > <h2><a name="top">The Money Pit</a></h2>
> > 
> > Hurray! :D
> 
> Good job.
> :-)
> 
> Regards,
> Erwin Moller

0
Reply gmgj 6/14/2006 12:48:46 PM

JRS:  In article <448e7b9c$0$31640$e4fe514c@news.xs4all.nl>, dated Tue,
13 Jun 2006 10:47:24 remote, seen in news:comp.lang.javascript, Erwin
Moller <since_humans_read_this_I_am_spammed_too_much@spamyourself.com>
posted :
>
>I would absolutely advise the fat book of O'Reilly, AKA the bible:
>Javascript, The definite Guide 4th edition.
>
>It is THE reference and also serves as a great learningbook.
>Hence it's fatness. ;-)


Is that a recommendation given in the knowledge that the 5th Edition was
described as "soon" over a month ago?

For searchers : it's "JavaScript: The Definitive Guide".

<FAQENTRY> Sec 3.1 needs review.
 
-- 
 � John Stockton, Surrey, UK.  ?@merlyn.demon.co.uk   Turnpike v4.00   IE 4 �
 <URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript 
 <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
 <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
0
Reply Dr 6/14/2006 3:20:44 PM

Dr John Stockton wrote:

> JRS:  In article <448e7b9c$0$31640$e4fe514c@news.xs4all.nl>, dated Tue,
> 13 Jun 2006 10:47:24 remote, seen in news:comp.lang.javascript, Erwin
> Moller <since_humans_read_this_I_am_spammed_too_much@spamyourself.com>
> posted :
>>
>>I would absolutely advise the fat book of O'Reilly, AKA the bible:
>>Javascript, The definite Guide 4th edition.
>>
>>It is THE reference and also serves as a great learningbook.
>>Hence it's fatness. ;-)
> 
> 
> Is that a recommendation given in the knowledge that the 5th Edition was
> described as "soon" over a month ago?

Hi John,

No, my recommendations are always given without knowledge.
Knowledge is overrated. :P

But yes, I saw that 5th edition announced in this very group.

> 
> For searchers : it's "JavaScript: The Definitive Guide".

Hmm, definitive? LOL.
I must have misread that title for ages then.
And also the former editions. 
Anyway, thanks for correcting.
(Goes off buying new glasses.)

Regards,
Erwin Moller


> 
> <FAQENTRY> Sec 3.1 needs review.
>  

0
Reply Erwin 6/14/2006 8:56:55 PM

8 Replies
342 Views

(page loaded in 0.396 seconds)

Similiar Articles:













7/22/2012 3:57:45 PM


Reply: