J
jason
I've got this javascript routine (i found on google - thank you) in an
asp.net page that on page reload sets the cursor of a textbox to the
last line. It works great!
Using a similar concept, I have another application that uses a
textbox like an editor window and has a save and other buttons.
Problem is - when I save/post/reload, the textbox returns to cursor
the top again.
How can I preserve / save the exact cursor spot and return to the
exact same spot I was in before I saved.
Here's the javascript code that sets the spot to the bottom of the
text. It called from <body onload=
<<<code>>>>
function f(){
var d=document;
if(d.getElementById){
var el=d.getElementById("chat");
if(el && el.createTextRange){
var rng=el.createTextRange(),
pos=el.value.length;
if(pos!=-1 && rng){
rng.moveStart("character",pos+1);
rng.collapse();
rng.select();
}
}
}
}
<<<code>>>>
I am imagining I will need to likely call the javascript with register
from asp.net. I'm just wondering how I can return position values to
serverside to save as a session variable - if that's even the best
way. Also, not clear on javascript code.
Thanks. Any help or information is greatly appreciated!
asp.net page that on page reload sets the cursor of a textbox to the
last line. It works great!
Using a similar concept, I have another application that uses a
textbox like an editor window and has a save and other buttons.
Problem is - when I save/post/reload, the textbox returns to cursor
the top again.
How can I preserve / save the exact cursor spot and return to the
exact same spot I was in before I saved.
Here's the javascript code that sets the spot to the bottom of the
text. It called from <body onload=
<<<code>>>>
function f(){
var d=document;
if(d.getElementById){
var el=d.getElementById("chat");
if(el && el.createTextRange){
var rng=el.createTextRange(),
pos=el.value.length;
if(pos!=-1 && rng){
rng.moveStart("character",pos+1);
rng.collapse();
rng.select();
}
}
}
}
<<<code>>>>
I am imagining I will need to likely call the javascript with register
from asp.net. I'm just wondering how I can return position values to
serverside to save as a session variable - if that's even the best
way. Also, not clear on javascript code.
Thanks. Any help or information is greatly appreciated!