Yep possible with JS.
I believe I copied all the code I use to do this, hope it makes sense...
// get cursor position
function fnCursorPosition( obj )
{
var i = obj.value.length + 1;
if ( obj.createTextRange )
{
cursorPosition =
document.selection.createRange().duplicate();
while ( cursorPosition.parentElement() == obj &&
cursorPosition.move("character",1) ==1 )
{
--i;
}
return i;
}
else
{
return -1;
}
}
function fnMoveCursor( obj, position )
{
if ( obj.createTextRange )
{
obj.caretPos = document.selection.createRange().duplicate();
var text = obj.createTextRange();
if ( obj.type == 'text' )
text.move("character", position -1);
else
text.move("character", position);
text.select();
}
}
Taco Fleur
Blog http://www.tacofleur.com/index/blog/
Methodology http://www.tacofleur.com/index/methodology/
0421 851 786
Tell me and I will forget
Show me and I will remember
Teach me and I will learn
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Mark Stanton
> Sent: Thursday, 22 January 2004 3:20 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Controlling cursor position within a text input
>
>
> Hi All
>
> If I have a form laid out as follows:
>
> <input type="text" value="somevalue" name="input1"><br>
> <input type="text" value="someothervalue" name="input2">
>
> If the user tabs down the page & starts tabbing down the form
> the entire contents of the field is selected by default. If
> the user immediately starts typing they will replace the
> contents of the field.
>
> My question is it possible (using onFocus() or something) to
> move the cursor to the end of the field value when a user
> tabs into the field?
>
> I guess I want the user to append to the value by default
> rather than replacing it.
>
>
> Cheers
>
> Mark
>
>
> ------------------
> Mark Stanton
> Technical Director
> Gruden Pty Ltd
> Tel: 9956 6388
> Mob: 0410 458 201
> Fax: 9956 8433
> http://www.gruden.com
>
>
> ---
> You are currently subscribed to cfaussie as:
> [EMAIL PROTECTED] To unsubscribe send a blank email to
> [EMAIL PROTECTED]
>
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004