document.body.appendChild(i)

后端 未结 6 1334
傲寒
傲寒 2020-12-08 19:50

I am getting error only in IE7 as document.body is null; when I debug with Microsoft script editor I am getting the error in the following line: i.e.

6条回答
  •  悲&欢浪女
    2020-12-08 20:08

    May also want to use "documentElement":

    var elem = document.createElement("div");
    elem.style = "width:100px;height:100px;position:relative;background:#FF0000;";
    document.documentElement.appendChild(elem);
    

提交回复
热议问题