文本框获得焦点时选中文本框中的文字
2017-11-21 13:44
190 查看
<!doctype html>
<html>
<head>
<!--文本框获得焦点时选中文本框中的文字-->
<style>
</style>
<script>
function test(){
var test=document.getElementById("test");
test.select();//选中框中的所有文本;
}
</script>
<meta charset="UTF-8">
</head>
<body>
<input type="text" value="xisix" id="test" onfocus="test()">
</body>
</html>
<html>
<head>
<!--文本框获得焦点时选中文本框中的文字-->
<style>
</style>
<script>
function test(){
var test=document.getElementById("test");
test.select();//选中框中的所有文本;
}
</script>
<meta charset="UTF-8">
</head>
<body>
<input type="text" value="xisix" id="test" onfocus="test()">
</body>
</html>
相关文章推荐
- WPF TextBox 获得焦点后,文本框中的文字全选中
- 文本框获得焦点后立刻选中文本框中文本
- javaScript让文本框内的最后一个文字的后面获得焦点实现代码
- javaScript让文本框内的最后一个文字的后面获得焦点实现代码
- jQuery, 文本框获得焦点后, placeholder提示文字消失
- jquery 获得焦点的时候,焦点时文本框清空,失去焦点时又显示默认文字
- javaScript:让文本框内的最后一个文字的后面获得焦点
- jQuery表单input文本框默认说明文字获得焦点后消失效果
- jquery插件小试牛刀:文本框为空时默认文字显示,获得焦点后默认文字消失
- VB的文本框得到焦点时,自动选中里面的文字
- 文本框获得焦点,并且同时清空文本框内原有的文字。 如果文本框内已经有用户输入的内容了,那么就不应该进行清除文本款内容这个动作
- IE浏览器控件页面如何在选中的文本框输入焦点输入文字
- 在文本框中有一行灰色文字,获得焦点并输入时自动消失
- ASP.NET中页面加载时文本框内有文字获得焦点时文字消失
- javaScript:让文本框内的最后一个文字的后面获得焦点
- ASP.NET中页面加载时文本框(texbox控件)内有文字获得焦点时文字消失
- jQuery表单Input文本框默认说明文字获得焦点后消失效果
- jQuery表单Input文本框默认说明文字获得焦点后消失效果
- jQuery表单Input文本框默认说明文字获得焦点后消失效果
- 如何在单击label标签时让文本框获得焦点?