Password select() 方法

定義和用法
select() 方法用于選取密碼域中的文本
語法
passwordObject.select()
瀏覽器支持
所有主要瀏覽器都支持 select() 方法
實例
實例
下面的例子可選取密碼域中的文本:
<html>
<head>
<script>
function myFunction()
{
document.getElementById("pwd").select();
}
</script>
</head>
<body>
<form>
Password: <input type="password" id="pwd" value="thgrt456">
</form>
<button type="button" onclick="myFunction()">Select content</button>
</body>
</html>
<head>
<script>
function myFunction()
{
document.getElementById("pwd").select();
}
</script>
</head>
<body>
<form>
Password: <input type="password" id="pwd" value="thgrt456">
</form>
<button type="button" onclick="myFunction()">Select content</button>
</body>
</html>
嘗試一下 ?

更多建議: