点击之后为什么不变色呢
index.ejs
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/index.css' />
</head>
<body>
<header>
<h1><%= title %></h1>
</header><!-- /header -->
<div class="left">
<ul id="list">
<% music.forEach(function(name){%>
<li><%= name%></li>
<%})%>
</ul>
</div>
<div class="right"></div>
<script type="text/javascript" src="/javascripts/index.js"></script>
</body>
</html>
index.js
function $(s){
return document.querySelectorAll(s);
}
var lis=$("#list li");
for(var i=0;i<lis.length;i++){
lis[i].onclick=function(){
for(var j=0;j<lis.length;j++){
lis[j].className="";
}
this.className="selected";
}
}