在文本框内切换 [英] Tabbing inside Textbox

查看:78
本文介绍了在文本框内切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

当我在多行文本框中书写内容并按Tab键时,它将转到下一个控件,但我想将4个字符移动到其他控件中.

请帮我做这个

我在Google中进行搜索,并在Windows应用程序的文本框中获得了"AcceptsTab"属性,该属性将在文本框中启用和可拨号的制表符.

但没有在Web应用程序中获得此属性..

如何在Web应用程序中实现(使用javascript或服务器端).
(我不是想在一个文本框中实现所有功能)


请帮忙
在此先感谢

Hi all

When i am writing something inside a multi lined textbox and press tab key ,it goes to the next control but i want to move 4 character not to other control.

Please help me to do this

I searched in Google and got ''AcceptsTab'' property in Windows Application for textbox,which will enable and diaable tabbing inside the textbox.

but didn''t get such property in web application..

How to implement the in web application (using javascript or server side).
(I want to implement this type of feature in a textbox not all)


Please help
Thanks in advance

推荐答案

尝试一下
function bindTabbing(event)
{
    if (event.which || event.keyCode)
    {
        // 9 indicates TAB key.
        if ((event.which == 9) || (event.keyCode == 9))
        {
            var subject = document.getElementById(txtProgramEditor); // Get the Editor textarea control.
            if (event.srcElement == subject) // If tab is pressed in the textarea then do the action.
            {
                // Creates a range and adds the Tab equivalent character in the text range.
                subject.selection = document.selection.createRange();
                subject.selection.text = String.fromCharCode(9);
                event.returnValue = false;
            }

            if (subject.selectionStart || subject.selectionStart == '0')
            {
                var str = subject.value;
                var startIndex = subject.selectionStart;
                subject.value = str.substring(0, startIndex) + '    ' + str.substring(startIndex, str.length);
                subject.focus();
                subject.selectionEnd = startIndex + 4;
                return false;
            }
        }
    }
    else
    {
        return true;
    }
}


尝试一下..

Try this..


(' #textboxid' span>).live(' keydown',function(e){ var keyCode = e.keyCode || e.哪个; var s =
('#textboxid').live('keydown', function(e) { var keyCode = e.keyCode || e.which; var s=


这篇关于在文本框内切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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