OT Javascript scrolling textarea
Randy Jonasz
rjonasz-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Nov 21 21:52:12 UTC 2006
Hey Everyone,
This q is not specific to linux but I know there are quite a few
people on the list who know javascript really well. I need to write
some javascript which will scroll a textarea down to where the caret
position is. So far the code I have works for IE but not Firefox.
The code for firefrox is
Note: inpu = textarea
var ev = document.createEvent ('KeyEvents');
ev.initKeyEvent('keypress', true, true, window,false, false, false,
false, 0,inpu.value.charCodeAt(pos-1));
inpu.dispatchEvent(ev); // causes the scrolling
inpu.setSelectionRange(pos, pos);
Any help would be greatly appreciated!
Cheers,
Randy
--
Imagine no possessions
I wonder if you can
No need for greed or hunger
A brotherhood of man
Imagine all the people
Sharing all the world
--John Lennon
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list