对DOM对象的三种操作

 var span = document.getElementById("today");

//  设置内容

 span.innerText = "天空好像下雨";
    span.innerHTML = "<font color='deepskyblue'>天空好像下雨</font>";

//设置属性

 span.setAttribute("color","green");

//设置样式

  span.setAttribute("style","font-family: 幼圆;");

posted @ 2019-11-21 19:56  猫狗日记  阅读(175)  评论(0编辑  收藏  举报