It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Cursor position in text field

Cursor position in text field

Postby Chili_Bilis on Wed Aug 06, 2008 1:25 pm

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 string in field (all the numbers should be in blue, 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.
Chili_Bilis
 
Posts: 2
Joined: Wed Aug 06, 2008 1:10 pm

Postby Chili_Bilis on Wed Aug 06, 2008 4:22 pm

Thanks, but found solution myself.

Sorry, for making useless post.
Chili_Bilis
 
Posts: 2
Joined: Wed Aug 06, 2008 1:10 pm


Who is online

Users browsing this forum: No registered users and 7 guests