<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<p ondblclick="alert(123)">ppppp</p>

<input class="keyword" type="text" onfocus="func1()" onblur="func2()" value="请输入用户名">
<input type="text">


<script>
function func1() {
// console.log(111)
var ky=document.getElementsByClassName("keyword")[0];
ky.value="";


}
function func2() {

var ky=document.getElementsByClassName("keyword")[0];
if (ky.value.trim().length==0){
ky.value="请输入用户名";
}
}
</script>
</body>
</html>

相关文章:

  • 2022-12-23
  • 2022-01-01
  • 2021-06-29
  • 2022-03-11
  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
猜你喜欢
  • 2021-12-20
  • 2021-10-20
  • 2021-09-06
  • 2021-12-07
  • 2021-06-25
  • 2021-05-24
相关资源
相似解决方案