1.要求代码实现如下:
“账号”和“密码”为必填项且自动获得光标焦点;
设置“密码”由字母开头,长度为6-10,仅包含数字,字母和下划线;
“邮箱”检查其格式的合法性。
代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录表单</title>
<style>
span{
color:red;
font-weight: bold;
}
</style>
</head>
<body>
<form action="" id="myForm">
<p>
账号:<input type="text" id="username" autofocus="autofocus" onkeyup="checkUserName(this)"/>
<span><i class="error">*</i></span>
</p>
<p>
密码:<input type="text" id="password" autofocus="autofocus" onkeyup="checkPassword(this)"/>
<span><i class="er