Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to manage cursor?

10 views
Skip to first unread message

justaguy

unread,
May 24, 2013, 2:26:43 PM5/24/13
to
Hi,

I have two DIVs, one in the left and the other right.
More info:
*
left DIV (id of 'leftD') is empty by default, right DIV (id of 'rightD') has lots of contents.
*
when a user scrolls down for the right DIV, and find one piece of content interesting something, say, content 8 (id of 'content8'), click on it (clickAction) and brings it to the top of the left DIV ('leftD'). No problem, so far so good.

Issue:
However, the cursor does not go with the above action, that is, the screen remains the same (still at the bottom of the right DIV). What could I do to make the cursor to move to the top of the left DIV?
My attempt of adding the following statement,
document.getElementById('leftD').focus();
prior to clickAction
OR
after
has no effects.

How to do it?

Many thanks.



Danny

unread,
May 24, 2013, 3:00:16 PM5/24/13
to
to justaguy

document.getElementById('leftD').scrollInToView()

Dr....@nyc.rr.com

unread,
May 24, 2013, 3:20:26 PM5/24/13
to
On Fri, 24 May 2013 11:26:43 -0700 (PDT), justaguy <lichun...@gmail.com>
wrote in <3d37a9e7-b930-4e64...@googlegroups.com>:


>However, the cursor does not go with the above action, that is, the screen remains the same (still at the bottom of the right DIV). What could I do to make the cursor to move to the top of the left DIV?
>My attempt of adding the following statement,
>document.getElementById('leftD').focus();
>prior to clickAction
>OR
>after
>has no effects.

You described:
document.getElementById('leftD').focus();
function clickAction(){code}
OR
function clickAction(){code}
document.getElementById('leftD').focus();

will not get the focus statement executed.

You need:
onclick="clickAction();document.getElementById('leftD').focus();"
OR
function clickAction(){code ;
document.getElementById('leftD').focus(); }

HTH


justaguy

unread,
May 24, 2013, 5:34:31 PM5/24/13
to
On Friday, May 24, 2013 3:00:16 PM UTC-4, Danny wrote:
> to justaguy
>
>
>
> document.getElementById('leftD').scrollInToView()

Danny, beautiful, thanks, and you're a great typist :)

Thomas 'PointedEars' Lahn

unread,
May 25, 2013, 1:37:01 AM5/25/13
to
Which proves that a great typist can be a lousy programmer.

--
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
0 new messages