var span = document.getElementById("today");
// 设置内容
span.innerText = "天空好像下雨";
span.innerHTML = "<font color='deepskyblue'>天空好像下雨</font>";
//设置属性
span.setAttribute("color","green");
//设置样式
span.setAttribute("style","font-family: 幼圆;");
var span = document.getElementById("today");
// 设置内容
span.innerText = "天空好像下雨";
span.innerHTML = "<font color='deepskyblue'>天空好像下雨</font>";
//设置属性
span.setAttribute("color","green");
//设置样式
span.setAttribute("style","font-family: 幼圆;");
来源:https://www.cnblogs.com/tanghao22/p/11907917.html