代码:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/jquery.js"></script>
</head>
<body>
<input id="userName" type="text"><br/>
<input id="password" type="text"><br/>
<button id="btn" type="button">提交</button>
<script type="text/javascript">
$('#btn').click(function(){
if($('#username').val().length==0){
alert('输入不能为空')
}else if($('#password').val().length<6){
alert('输入长度不可少于6位')
}
});
</script>
</body>
</html>