Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi friends,

i am using the text box in my web user control, i have the default value in that textbox , its works fine in all browsers ,

but in internet explorer the cursor is placing at the beginning of the text

but i need to display in end of the text

code
----

XML
<asp:TextBox ID="txtcode" runat="server" defaultValue="Code"
           onfocus="codeOnFocus(this.value);" onblur="javascript:codeOnBlur(this.value);" >CodeNo-</asp:TextBox>


code for onblur() and onfocus()
-------------------------------
C#
function codeOnFocus(value1) {
    var txtCode1 = document.getElementById('<%=txtCode.ClientID %>');

        if (value1 == 'Code')
             txtBrokerCode1.value = 'CodeNo-';
        if (value1 == 'CodeNo-')
             txtBrokerCode1.value('ARN-')
      }

      function codeOnBlur(value2) {
      var txtCode2 = document.getElementById('<%=txtCode.ClientID %>');
      if (value2 == 'ARN-')
        txtBrokerCode2.value = '';
      }



so anyone help me

thanks in advance
Velsamy
Posted
Updated 4-Jun-14 21:28pm
v3
Comments
DamithSL 5-Jun-14 2:55am    
update question with codeOnFocus and codeOnBlur methods
Ajith K Gatty 5-Jun-14 3:48am    
hey,
Correct your Id names ok. in script u are using wrong Id's.Check spellings.
avelsamy 5-Jun-14 4:43am    
i have corrected the code , but the cursor is placed beginning of the text
Ajith K Gatty 5-Jun-14 3:52am    
And i checked your code with IE.It is proper.
avelsamy 5-Jun-14 4:45am    
the cursor is blinking beginning of the text like |CodeNo- like this (here | is a cursor)

1 solution

 
Share this answer
 
Comments
avelsamy 5-Jun-14 4:41am    
i have used this one , the select is not a member of web user control error occuring....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900