求救,关于createElement创建div的问题?在线
<html>
<head>
<SCRIPT LANGUAGE=javascript>
function bbb()
{
var str = document.createElement("div");
str.id = "asdf";
str.style.position = "absolute";
str.style.setAttribute("left","1px");
str.style.setAttribute("top","1px");
str.style.setAttribute("width","100px");
str.style.setAttribute("height","100px");
str.style.setAttribute("border","1 solid #000000");
//str.style.setAttribute("background-color","#000000");
//str.style.setAttribute("layer-background-color","#000000");
str.style.setAttribute("z-index","1");
document.body.appendChild(str);
}
</SCRIPT>
</head>
<body>
<input type=button value=test onclick="bbb()">
</body>
</html>
我用background-color和layer-background-color都没有任何反应,怎么办?