Scrolling with keyboard keys immediately after page loads

W

wylbur37

I'm trying to implement a typical webpage with a sidebar menu on the
left side and a "main" display window to the right of it. When any of
the links on the sidebar are clicked, the corresponding page opens in
the "main" window.

This is typically done using FRAMEs.
The control page looks something like this ...

<FRAMESET COLS="15%,*">
<FRAME NAME="sidebar" SRC="menu.HTM">
<FRAME NAME="main" SRC="intro.HTM">
</FRAMESET>

The links in "menu.HTM" would look something like this ...

<a HREF="page1.htm" target="main">Page One</a>

(Notice that I'm using local web pages for simplicity).

Anyway, I discovered that as soon as the page for the link that's
clicked loads in the "main" frame window, if the contents is longer
than the height of the frame window and I need to scroll, I can *NOT*
immediately use the PgUp, PgDn, Up-Arrow or Down-Arrow keys on the
keyboard. I must first click the mouse arrow somewhere in the "main"
frame window, and only then will I be able to use the PgUp, PgDn,
Up-Arrow or Down-Arrow keys on the keyboard to scroll.

Why is this? Is there a way to specify that as soon as a page loads in
the "main" frame window, I should be able to *immediately* use the
PgUp, PgDn, Up-Arrow or Down-Arrow keys on the keyboard, *without*
having to first click the mouse arrow somewhere in the "main" frame
window?

Is this a matter of finding the correct browser setting,
or is it done by HTML code? or both?

....
 
J

Jake

In message said:
I'm trying to implement a typical webpage with a sidebar menu on the
left side and a "main" display window to the right of it. When any of
the links on the sidebar are clicked, the corresponding page opens in
the "main" window.

This is typically done using FRAMEs.
The control page looks something like this ...

<FRAMESET COLS="15%,*">
<FRAME NAME="sidebar" SRC="menu.HTM">
<FRAME NAME="main" SRC="intro.HTM">
</FRAMESET>

The links in "menu.HTM" would look something like this ...

<a HREF="page1.htm" target="main">Page One</a>

(Notice that I'm using local web pages for simplicity).

Anyway, I discovered that as soon as the page for the link that's
clicked loads in the "main" frame window, if the contents is longer
than the height of the frame window and I need to scroll, I can *NOT*
immediately use the PgUp, PgDn, Up-Arrow or Down-Arrow keys on the
keyboard. I must first click the mouse arrow somewhere in the "main"
frame window, and only then will I be able to use the PgUp, PgDn,
Up-Arrow or Down-Arrow keys on the keyboard to scroll.

Why is this?

Because you're still focused on the frame with the link you clicked on.
All you've done is load some content into a named frame; focus doesn't
move from that frame unless you move it e.g. use F6 key (Internet
Explorer) or click the mouse in the frame.

Is there a way to specify that as soon as a page loads in
the "main" frame window, I should be able to *immediately* use the
PgUp, PgDn, Up-Arrow or Down-Arrow keys on the keyboard, *without*
having to first click the mouse arrow somewhere in the "main" frame
window?

No. Not that I know of.
Is this a matter of finding the correct browser setting,
or is it done by HTML code? or both?
It's working as it should.
Regards.
 
2

221713540Stephen Mozyra

Hello, wylbur37!
You wrote on 1 Oct 2005 04:47:56 -0700:

[Sorry, skipped]
w> Why is this? Is there a way to specify that as soon as a page loads
w> in the "main" frame window, I should be able to *immediately* use the
w> PgUp, PgDn, Up-Arrow or Down-Arrow keys on the keyboard, *without*
w> having to first click the mouse arrow somewhere in the "main" frame
w> window?
[Sorry, skipped]

Try to use javascript. Maybe, OnLoad even for BODY in main frame. For
example:
....
<body onLoad="document.focus()">
....

There is a method focus() for body element, but it's not working in myIE.
So, you should try something more complex:
....
<body onLoad="document.getElementById('firstLink').focus()">
<a href="..." id="firstLink">This is a first link in your main page, or
it may be image, or smth else?</a>
....


// WBR, Stephen Mozyra
// SM17-UANIC, http://cave.no-ip.biz
 

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,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top