Cursor in Text field

I have some form fields like
       <!-- FirstName Field  //-->        
     <div class="formfield_row">
         <div class="formfield_label"> <%= firstNameLabel %> <span class="required">*</span></div>
         <div class = "formfield_input">
           &nbsp;<input  class="formfield"
                           type="text"
                           name="usr_firstname"
                           value="<%= firstName%>"
                                   onfocus="if(this.value=='<%= usrFirstNameDefault %>')this.value = ''"
                                  onblur="if(this.value=='')this.value='<%= usrFirstNameDefault %>';"
                           maxLength="30"/>
          </div>
      </div>

      <!-- LastName Field  //-->
    <div class = "formfield_row">
        <div class = "formfield_label"><%= lastNameLabel %> <span class="required">*</span></div>
        <div class = "formfield_input">
               &nbsp;<input class="formfield"
                                       type = "text"
                                 name = "usr_lastname"
                                 value = "<%= lastName%>"
                                 onfocus="if(this.value=='<%= usrLastNameDefault %>')this.value = ''"
                                   onblur="if(this.value=='')this.value='<%= usrLastNameDefault %>';"
                                 maxLength = "30"/>
          </div>
     </div>
   
      <!-- CompanyName Field   //-->    
    <div class = "formfield_row">
            <div class = "formfield_label"><%= compNameLabel %></div>
            <div class = "formfield_input">
            &nbsp;<input class="formfield"
                                 type = "text"
                           name = "usr_comp_name"
                           value = "<%= compName%>"
                           onfocus="if(this.value=='<%= usrCompNameDefault %>')this.value = ''"
                                   onblur="if(this.value=='')this.value='<%= usrCompNameDefault %>';"
                              maxLength = "30"/>
            </div>
      </div>
     

The problem is that when the user navigates from one field to another using "Tab", a blinking cursor is not placed in that field. Is there any way to enforce it?
When the user clicks on the field using a mouse then its working fine.
Thanks
LVL 8
thomas908Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
In what browser on what platform?

If I tab in IE win, there is a big blue highlight - not a blinking cursor. That is normal behaviour and something I as a user REALLY prefer
If you want the blinking cursor, you need an empty field
0
thomas908Author Commented:
It's IE on windows.
0
thomas908Author Commented:
The contents in the field get erased as soon as the focus comes on that field. But the problem is that the curson is not displayed. There is no big blue highlight in this case. Also If I click on the field using mouse the cursor appears. I want it to appear when tab navigating.
0
Michel PlungjanIT ExpertCommented:
You do not get the cursor when you set the value.

Here is the solution:

onfocus="if(this.value==defaultValue) this.value = ''; this.select()"
onblur="if(this.value=='') this.value=this.defaultValue"

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thomas908Author Commented:
Thanks a lot. That works perfect
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.