如何使用 Element.style.styleFloat

How to use Element.style.styleFloat?

本文关键字:styleFloat style Element 何使用      更新时间:2023-09-26

以下一行不起作用:

document.getElementById("attribute").setAttribute("style", "float: right");
document.getElementById("field").style.styleFloat = "right";

见 http://jsfiddle.net/2kvEA/

怎么了?如何避免 setAttribute()?

我们使用dom

属性element.style.cssFloat来调整CSS的float属性,以避免使用JS保留字"float"。