当前位置 : 主页 > 网络编程 > JavaScript >

todolist

来源:互联网 收集:自由互联 发布时间:2021-06-28
homework.css @charset "utf-8";/* CSS Document */ul{list-style-type: none;margin: 0;padding: 0;}#to-do-list{background-image: url(homework-background.jpg);background-size: 100%;padding: 5%;width: 55%;height: 65%;overflow: auto;border: 6px #5
homework.css
@charset "utf-8";
/* CSS Document */
		ul{
			list-style-type:        none;
			margin:                 0;
			padding:                0;
		}

		#to-do-list{
			background-image:       url(homework-background.jpg);
			background-size:        100%;

			padding:                5%;
			width:                  55%;
			height:                 65%;
			overflow:               auto;
			border:                 6px #555 solid;

			top:                    40%;
			left:                   40%;
			position:               absolute;
			transform:              translate(-45%,-45%);
			
			color:                  white;
			font-family:            cursive;
			font-size:              xx-large;
		}
		#clock img{
			width:                  15px;
			height:                 15px;
		}
		#clock{
			font-size:              1.2em;
			color:                  white;
			text-align:             center;
			margin:                 0;
			padding:                0;
			position:               absolute;
			top:                    70%;
			left:                   55%;
		}
homework.html



 
work

 
	






 

  
   TO DO LIST
  


  
    : :
    年 月 日
    星期
    homework.js
    // JavaScript Document
    var oUl1=document.getElementById('ul1');
    var oTxt1=document.getElementById('txt1');
    var oBtn1=document.getElementById('btn1');
    oBtn1.onclick=function(){
    	if(oTxt1.value==''){
    		alert('请输入点儿什么吧!');
    	}else{
    	var oNewLi=document.createElement('li');
    	var oUl1AllLi=document.getElementsByTagName('li');
    	var oSpan=document.createElement('span');
    	oSpan.innerHTML=oTxt1.value;
    	var oIpt=document.createElement('input');
    	oIpt.type='checkbox';
    	oIpt.name='checkbox1';
    	oNewLi.appendChild(oIpt);
    	oNewLi.appendChild(oSpan);
    	if(oUl1AllLi.length===0){
    		oUl1.appendChild(oNewLi);
    	}else{
    		oUl1.insertBefore(oNewLi,oUl1AllLi[0]);
    	}
    	oTxt1.value='';
    	}
    };
    
    
    
    var oBtn2=document.getElementById('btn2');
    oBtn2.onclick=function(){
        var oCheckbox=document.getElementsByName('checkbox1');
    	for(var i=0;i
    网友评论