点击标签时选择文本 [英] Selecting Text while hitting tab

查看:89
本文介绍了点击标签时选择文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个文本框,其中最后一个启用了多行属性.
首先,第一个文本框是焦点,当我按下TAB按钮时,焦点将更改为下一个文本框,并且还将选中焦点文本框中的那个文本区域.
但是在多行文本框中,通过按TAB键可以使文本区域不被选中.我该如何解决.请帮助我解决这个问题..

I have 3 text boxes in which last one is multiline property enabled.
At first focus is in first textbox, when i hit TAB button focus changed to next textbox and along with that textarea in focused textbox is also selected.
But in multiline textbox text area is not get selected while it get focused by hitting TAB key. How can I solve this. Please help me to solve this..

推荐答案

<script type="text/javascript">
function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}
</script>

Textarea:<br>
<textarea rows="3" id="txtarea" onClick="SelectAll('txtarea');" style="width:200px" >This text you can select all by clicking here or pressing TAB key </textarea>

Input TextBox:<br>
<input type="text" id="txtfld" onClick="SelectAll('txtfld');" style="width:200px" value = "This text you can select all" />
</br></br>



希望这可以帮助您...

问候,
尼拉·索尼(Nial Soni)



Hope this may help you out...

Regards,
Niral Soni


这篇关于点击标签时选择文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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