这种使用不太标准,换一下:
var toolTipLayer = document.createElement("DIV");
toolTipLayer.id = "toolTipLayer";
toolTipLayer.style.position = "absolute";
toolTipLayer.style.zIndex = "1";
toolTipLayer.style.display = "none"; //这里也可以使用 visibility
document.body.appendChild(toolTipLayer);
var toolTipLayer = document.createElement("DIV");
toolTipLayer.id = "toolTipLayer";
toolTipLayer.style.position = "absolute";
toolTipLayer.style.zIndex = "1";
toolTipLayer.style.display = "none"; //这里也可以使用 visibility
document.body.appendChild(toolTipLayer);
然后通过toolTipLayer 对象设置div的相关属性跟style就OK了