JavaScript 参考手册教程
HTML DOM Password select() 方法
HTML DOM Password select() 方法
Password select() 方法
Password 对象定义和用法
select() 方法用于选取密码域中的文本
语法
passwordObject.select()
浏览器支持
所有主要浏览器都支持 select() 方法
实例
实例
下面的例子可选取密码域中的文本:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>非常教程(verydoc.net)</title>
<script>
function myFunction(){
document.getElementById("pwd").select();
}
</script>
</head>
<body>
<form>
密码: <input type="password" id="pwd" value="thgrt456">
</form>
<button type="button" onclick="myFunction()">选中内容</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>非常教程(verydoc.net)</title>
<script>
function myFunction(){
document.getElementById("pwd").select();
}
</script>
</head>
<body>
<form>
密码: <input type="password" id="pwd" value="thgrt456">
</form>
<button type="button" onclick="myFunction()">选中内容</button>
</body>
</html>
尝试一下 »
Password 对象
HTML DOM Password select() 方法 |
---|
JavaScript 参考手册
JavaScript 参考手册提供了完整的 JavaScript 对象、浏览器对象、HTML DOM 对象手册。手册包含了每个对象、属性、方法的实例。