Programmatically setting the "float" CSS property in Javascript

Jan 11 by Andre
IE and Firefox have different ways of doing this, and neither one is what you would expect.

In IE, it's myDiv.style.styleFloat="left";

In Firefox, it's myDiv.style.cssFloat="left";

Here's a full code block, with primitive browser detection included. This will work in both IE and Firefox:

if (document.all) {   // very basic browser detection
  var sFloat="styleFloat"; //ie
} else {
  var sFloat="cssFloat"; //firefox
}
var oMyDiv=document.getElementById("myId");oMyDiv.style[sFloat]="left";