我创建了一个div元素并在JavaScript中设置了它的样式属性:
var popupDiv = document.createElement("div");
popupDiv.style.background = "#fff";
popupDiv.style.border = "1px solid #e8e8e8";
popupDiv.style.padding = "20px";
popupDiv.style.position = "fixed";
...
但我也想补充一下:
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
所以我试过了:
popupDiv.style.webkitUserSelect = "none";
popupDiv.style.mozUserSelect = "none";
popupDiv.style.msUserSelect = "none";
popupDiv.style.userSelect= "none";
但只有“user-select:none;”属性设置正确...所以我的问题是...如何通过JS添加这些“不支持的”CSS属性?
(直接在css / inline中设置它们不是一种选择。)