js执行不了
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css.css">
<script type="text/javascript" src="js.js"></script>
</head>
<body>
<div class="header">
<div class="header-contene">
<div class="logo">
<p>慕课高铁客户服务中心 | <span>客户服务</span></p >
</div>
<div class="header-right">
<p>意见反馈 <span>imooc@com</span> 您好,请 <span>登录</span> | <span>注册</span> </p >
<span class="myImooc">我的IMOOC ▼
<ul class="list">
<li><a href="javascript:;">未完成订单</a></li>
<li><a href="javascript:;">已完成订单(改/退)</a></li>
<li class="li"></li>
<li><a href="javascript:;">我的保险</a></li>
<li class="li"></li>
<li><a href="javascript:;">查看个人信息</a></li>
<li><a href="javascript:;">账户安全</a></li>
<li class="li"></li>
<li><a href="javascript:;">常用联系人</a></li>
<li class="li"></li>
<li><a href="javascript:;">重点旅客预约</a></li>
<li><a href="javascript:;">遗失物品查找</a></li>
<li class="li"></li>
<li><a href="javascript:;">服务查询</a></li>
<li class="li"></li>
<li><a href="javascript:;">投诉</a></li>
<li><a href="javascript:;">建议</a></li>
</ul>
</span>
</div><!--header-right-->
<div class="phone">
<img src="素材/phone.png">
<p>手机版</p >
</div>
</div><!--header-contene-->
</div><!--header-->
<div class="main">
<div class="main-content">
<div class="main-top">您现在的位置:<span>客运首页>注册</span></div>
<div class="main-table">
<div class="main-table-title">账户信息</div>
<div class="main-table-content">
<div><!--用户名-->
<span>*</span>
<span>用 户 名: </span>
<input type="text" placeholder="用户名设置成功后不可修改" id="username" class="inputwidth">
<span class="tips"></span>
</div>
<div><!--登录密码-->
<span>*</span>
<span>登录密码: </span>
<input type="text" placeholder="6-20位字母,数字或符号" id="password" class="inputwidth">
<span id="red"></span> <span id="orange"></span> <span id="green"></span>
<span class="tips"></span>
</div>
<div><!--确认密码-->
<span>*</span>
<span>确认密码: </span>
<input type="text" placeholder="再次输入您的登录密码" id="confirmPassword" class="inputwidth">
<span class="tips"></span>
</div>
<div><!--姓名-->
<span>*</span>
<span>姓 名: </span>
<input type="text" placeholder="请输入姓名" id="nam" class="inputwidth">
<span class="tips"></span>
</div>
<div><!--证件类型-->
<span>*</span>
<span>证件类型: </span>
<select class="selectwidth">
<option>证件类型</option>
</select>
</div>
<div><!--证件号码-->
<span>*</span>
<span>证件号码: </span>
<input type="text" placeholder="请输入您的证件号码" id="idNumber" class="inputwidth">
<span class="tips"></span>
</div>
<div><!--邮箱-->
<span> </span>
<span>邮 箱: </span>
<input type="text" placeholder="请正确填写邮箱地址" id="email" class="inputwidth">
<span class="tips"></span>
</div>
<div><!--手机号码-->
<span>*</span>
<span>手机号码: </span>
<input type="text" placeholder="请输入您的手机号码" id="phone" class="inputwidth">
<span class="tips"></span>
</div>
<div><!--旅客类型-->
<span>*</span>
<span>旅客类型: </span>
<select class="selectwidth">
<option>旅客类型: </option>
</select>
</div>
<div>
<input type="checkbox" id="choose"> 我已阅读并遵守<a href="javascript:;">《中国铁路客户服务中心网站服务条款》</a>
</div>
<button>下一步</button>
</div><!--main-table-content-->
</div><!--main-table-->
</div><!--main-content-->
</div>
<div class="footer">
<p>关于我们 | 网站声明</p >
<p>Copyright © 2017 imooc.com All Rights Reserved | 京ICP备 13046642号-2</p >
</div>
</body>
</html>
js部分
var username=document.getElementById('username'),
password=document.getElementById('password'),
confirmPassword=document.getElementById('confirmPassword'),
nam=document.getElementById('nam'),
idNumber=document.getElementById('idNumber'),
email=document.getElementById('email'),
phone=document.getElementById('phone'),
tips=document.getElementsByClassName('tips'),
btn=document.getElementById('button');
var test1 = false,
test2 = false,
test3 = false,
test4 = false,
test5 = false,
test6 = false,
test7 = false;
username.onfocus = function(){
tips[0].innerHTML = "请输入6-30位字母、数字或'_',字母开头";
tips[0].style.color = "red";
}
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星