第五十四天:jQuery内容的基础:

1.上街内容的补充:

  1.1innerHTML:(获取子标签及子标签的内容·)

var d1Ele=document.getElementById('d1');
var d1H1=d1Ele.innerHTML;
console.log(d1H1);
var d1h1=d1Ele.innerHTML='';
console.log('d1h1',d1h1);
结果为:

    <div>dfhinhji</div>
    <p>fjinfjk</p>
    <h1>fjdsin</h1>

01上界内容回顾.js:8 d1h1 
View Code

  1.2输入框时间的问题:(清除有问题)

function foo(){
    t1=new Date();
    strT1=t1.toLocaleString();
    var d1Ele=document.getElementById('i1');
    d1Ele.value=strT1;

}
var t;
var startbutton=document.getElementById('start');
startbutton.onclick=function(){
    if (t==undefined){
        t=setInterval(foo,3000);
        t=1;
    console.log(t);
    }

}
var stopbutton=document.getElementById('stop');
stopbutton.onclik=function(){
    clearInterval(t);
    console.log('fhjh');
    t=undefined;
}
View Code

今日新内容:jQuery

2.基本选择器:

  2.1 id选择器:

$('#d1');
<div id=​"d1">​fjdkj​</div>​
View Code

  2.2标签选择器:

$('p');
<p id=​"p1">​fdjklj​</p>​
View Code

  2.3类选择器:

$('.c1');
View Code

  

  

猜你喜欢

转载自www.cnblogs.com/ab461087603/p/12611890.html