我如何在Acsx页面的我的文本框中的文本末尾设置光标 [英] How Do I Set The Cursor In End Of The Text In My Textbox In Acsx Page

查看:129
本文介绍了我如何在Acsx页面的我的文本框中的文本末尾设置光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我正在使用Web用户控件中的文本框,在该文本框中具有默认值,它在所有浏览器中都可以正常工作,

但在Internet Explorer中,光标位于文本的开头

但我需要在文本末尾显示

代码
----

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
----

<asp:TextBox ID="txtcode" runat="server" defaultValue="Code"

           onfocus="codeOnFocus(this.value);" onblur="javascript:codeOnBlur(this.value);" >CodeNo-</asp:TextBox>



onblur()和onfocus()的代码
-------------------------------



code for onblur() and onfocus()
-------------------------------

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 = '';
      }




有人帮我

在此先感谢
Velsamy




so anyone help me

thanks in advance
Velsamy

推荐答案

tbPositionCursor.Select(tbPositionCursor.Text.Length,0); [
tbPositionCursor.Select(tbPositionCursor.Text.Length, 0);[^]

Hope this may help you ..


这篇关于我如何在Acsx页面的我的文本框中的文本末尾设置光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆