class="title">测试
效果
const h2=document.querySelector('.title')
// classlist.add()添加类名
h2.classList.add('title1');
// clsslist.contains():判断是是否包含
console.log(h2.classList.contains('title1'));//显示true
console.log(h2.classList.contains('title3'));//显示false
// classlist.remove()删除类名
h2.classList.remove('title');
console.log(h2.classList.contains('title'));
// classlist.replace()替换类名
h2.classList.replace('title1','title');
console.log(h2.classList.contains('title1'));
// classlist.toggle()动态切换css
// 如果之前没有这个样式,就自动添加,如果有,则去掉这个样式
console.log(h2.classList.contains('title'));//显示true
h2.classList.toggle('title');
console.log(h2.classList.contains('title'));//显示false
h2.classList.toggle('title3');
console.log(h2.classList.contains('title3'));//显示true
action="" method="post" id="login">
class="title">用户登录
for="email">邮箱:
type="email" id="email" name="email" value="" autofocus />
for="password">密码:
type="password" id="password" name="password" />
name="submit" onclick="check(this)">登录