JavaScript和DOM
表格全选反选取消
选择 | 主机名 | IP | 端口 |
---|---|---|---|
c1.com | 192.168.1.80 | 80 | |
c1.com | 192.168.1.80 | 80 | |
c1.com | 192.168.1.80 | 80 |
添加标签
- helei
滚动标签
删除
显示时间
搜索框
<script type="text/javascript">// <![CDATA[
//全选
function allclick() {
var obj = document.getElementById('tb').children;
for(var i=0;i<obj.length;i++){
console.log(obj[i].firstElementChild.firstElementChild);
obj[i].firstElementChild.firstElementChild.checked=true;
}
}
//反选
function resetclick() {
var obj = document.getElementById('tb').children;
for(var i=0;i<obj.length;i++){
if(obj[i].firstElementChild.firstElementChild.checked==true){
obj[i].firstElementChild.firstElementChild.checked=false;
}else {
obj[i].firstElementChild.firstElementChild.checked=true;
}
}
}
//取消
function removeclick() {
var obj = document.getElementById('tb').children;
for(var i=0;i<obj.length;i++){
obj[i].firstElementChild.firstElementChild.checked=false;
}
}
//添加标签
function addmsg() {
var msg=document.getElementById('d2').firstElementChild.nextElementSibling.value;
if(msg.trim()!=''){
var obj = document.createElement('li');
obj.innerText=msg;
document.getElementById('u1').appendChild(obj);
document.getElementById('d2').firstElementChild.nextElementSibling.value='';
}
}
//欢迎李磊今天来上课
function welcome() {
var text_1 = document.getElementById('d3').lastElementChild.innerText;
var text_2 = text_1.substring(1,text_1.length+1).concat(text_1[0]);
document.getElementById('d3').lastElementChild.innerText = text_2;
console.log(text_2);
}
setInterval(welcome,1000);
//删除
function deleter() {
document.getElementById('d4').lastElementChild.innerText='已删除';
setTimeout(function () {
document.getElementById('d4').lastElementChild.innerText='';
},5000)
}
//显示时间
function times() {
data = new Date();
var year = data.getYear();
var moth = data.getMonth();
var day = data.getDate();
var hours = data.getHours();
var minu = data.getMinutes();
var sen = data.getSeconds();
var times = year+'-'+moth+'-'+day+' '+hours+':'+minu+':'+sen;
document.getElementById('d5').lastElementChild.innerText=times;
}
setInterval(times,1000);
// ]]></script>
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd
sdd