一个简单的前端信息列表管理
未做信息录入验证
页面元素
<input id="sname" type="text" placeholder="name"/>
<input id="sid" type="text" placeholder="id"/>
<input id="sage" type="text" placeholder="age"/>
<input id="sadd" type="button" value="add"/>
<hr />
<table>
<thead>
<tr>
<td>name<input id="sortbyname" type="button" value="sort"></td>
<td>id<input id="sortbyid" type="button" value="sort"></td>
<td>age<input id="sortbyage" type="button" value="sort"></td>
<td><input id="deleteAll" type="button" value="deleteAll"></td>
</tr>
</thead>
<tbody id="studenttable">
</tbody>
</table>
css样式
table{
border: solid 1px #292A38;
}
table td{
text-align: center;
width: 100px;
border: solid 1px #292A38;
}
js代码
window.onload = function(){
var students = new Array();
var studenttable = document.getElementById("studenttable");
var default_sort = 1;
var sortbyname = document.getElementById("sortbyname");
var sortbyid = document.getElementById("sortbyid");
var sortbyage = document.getElementById("sortbyage");
document.getElemen