Is it possible to set focus to a table cell?

J

jonny_morrisuk

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.
 
E

Erwin Moller

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
 
J

Jonathan

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
 
E

Erwin Moller

Jonathan said:
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
 
J

Jonathan

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 :/


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.
 
J

Jonathan

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
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Tue,
13 Jun 2006 10:47:24 remote, seen in Erwin
Moller said:
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.
 
E

Erwin Moller

Dr said:
JRS: In article <[email protected]>, dated Tue,
13 Jun 2006 10:47:24 remote, seen in Erwin



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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top