x
 
<!DOCTYPE html>
<html>
<body>
<h1>使用 select() 选择电子邮件字段的内容</h1>
电子邮件:<input type="email" id="myEmail" value="billgates@example.com">
<p>单击该按钮可选择电子邮件字段的内容。</p>
<button type="button" onclick="myFunction()">试一试</button>
<script>
function myFunction() {
  document.getElementById("myEmail").select();
}
</script>
</body>
</html>