Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cursor position in text field

    Hello everybody,

    I have a little problem here, maby you could help.. Here it is:

    I have a form and few input fields in it. Every input field has some kind of numeric value. For example:

    <form name="MyForm">
    <input type="text" name="MyField1" value="0">
    <input type="text" name="MyField2" value="20">
    <input type="text" name="MyField3" value="0,0">
    ...
    </form>

    I need an onFocus event, which would check if focused field value is "0", and if it is, replace that value with ",0" (comma, zero), and put cursor in front of that text (cursor, comma, zero). If value is not 0, then it shoud leave current value and select all the numeric string in field (all the numbers should be in blue background, and replaced if any key pressed).

    Could someone help me do it practically with javascript, please?

    Hope you understood me, sorry for the mistakes, i'm not from english-speaking country.

  • #2
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, but found solution myself.

    Sorry, for making useless post.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •