Input Text select() 方法
选取文本域的内容:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>蜜蜂教程(mifengjc.com)</title>
<script>
function myFunction() {
document.getElementById("email").select();
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email" value="someone@example.com">
</form>
<button type="button" onclick="myFunction()">选取内容</button>
</body>
</html>
定义和用法
select() 方法用于选取文本域中的内容。
浏览器支持
![]()
![]()
![]()
![]()
![]()
所有主流浏览器都支持 select() 方法 。
语法
textObject.select()
参数
| None. |
技术详情
| 返回值: | 没有返回值 |
|---|
Input Text 对象