代码如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册界面</title>
<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
<script type="text/javascript">
$(function(){
$('.input_test').bind({
focus:function(){
if(this.value==this.defaultValue){
this.value="";
}
},
blur:function(){
if(this.value==""){
this.value=this.defaultValue;
}
}
});
})
</script>
</head>
<body>
<div>
<div>
<span>新用户登录</span>
</div>
<div>
<form action="" method="post">
<table>
<tr align="right"><td>用户名:<input type="text" value="用户名长度为3~10" class="input_test"><span></span></td></tr>
<tr><td>登录密码:<input type="text" value="密码长度为3~10" class="input_test"><span></span></td></tr>
<tr><td>确认密码:<input type="text" value="密码长度为3~10" class="input_test"><span></span></td></tr>
<tr align="center"><td><input type="submit" value="注册"></td></tr>
</table>
</form>
</div>
</div>
</body>
</html>