满意答案
var mybody =document.getElementsByTagName("body")[0];
var mydiv = document.createElement("div");
var _mydiv = document.createElement("div");
var mybr = document.createElement("br");
var myspan = document.createElement("span");
var mys = document.createElement("s");
var myi = document.createElement("i");
mydiv.id=id;
mydiv.className = "containertip";
_mydiv.className = "contenttip";
myspan.className = "black12Tip";
mys.appendChild(myi);
_mydiv.appendChild(mybr);
_mydiv.appendChild(myspan);
var currenttext = document.createTextNode(message);
myspan.appendChild(currenttext);
mys.appendChild(myi);
mydiv.appendChild(_mydiv);
mydiv.appendChild(mys);
var divObj = document.getElementById(id);
if(divObj != undefined && divObj != null){
mybody.removeChild(divObj);
}
mybody.appendChild(mydiv);
看懂了 你就知道了
03分享举报