Password select() 方法

定義和用法
select() 方法用於選取密碼域中的文本
語法
passwordObject.select()
流覽器支持
所有主要流覽器都支持 select() 方法
實例
實例
下麵的例子可選取密碼域中的文本:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</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>IT研修(xuhuhu.com)</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>
