<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
window.onload=function(){
//账号提示
var uname=document.getElementById("uname");
uname.onfocus = function () {
uname.value = "";
}
uname.onblur = function () {
if (uname.value) {
return uname.value;
} else {
uname.value = "请输入账号名";
}
}
/**
* 密码提示
* 提示的时候,type为text,输入密码的时候type为password
*/
var pwd=document.getElementById("pwd");
pwd.onfocus = function(){
pwd.type = "password";
pwd.value = "";
}
pwd.onblur = function(){
if(pwd.value.length==0){
pwd.type = "text";
pwd.value = "请输入密码";
}else{
pwd.typs = "password";
}
}
}
</script>
</head>
<body>
<form action="#" method="post">
<div>
<table>
<tr>
<td colspan="2"><input type="text" value="请输入账号名" id="uname"></td>
<!--<td><span id="ts1"></span></td>-->
</tr>
<tr>
<td colspan="2"><input type="text" value="请输入密码" id="pwd"></td>
<!--<td><span id="ts2"></span></td>-->
</tr>
<tr>
<td><input type="button" value="登录"></td>
<td><input type="reset" value="重置" ></td>
</tr>
</table>
</div>
</form>
</body>
</html>