1、(onfocus)
2、(onblur)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function clearInput(){
var username = document.getElementById("username");
username.value='';
}
function clearGetput(){
var username = document.getElementById("username");
username.value='';
}
function a(){
var username = document.getElementById("password");
username.value='';
}
function b(){
var username = document.getElementById("password");
username.value='';
}
</script>
<body>
用户名:<input type="text" id="username" οnfοcus="clearInput()" value="请输入用户名" οnblur="clearGetput()"/>
密码:<input type="password" id="password" οnfοcus="a()" value="请输入密码" οnblur="b()" />
</body>
</head>
</html>