Today when I tried to set the CSS "Float" property of a HTML div using JavaScript, I got stuck , I could not figure out why my code was not working .
I was using the following code:
I was using the following code:
var tile=document.getElementById("rectTile");
tile.style.float="left";
tile.style.float="left";
Then I searched why it did not work. I realized that for my code to work I need to make following changes:
tile.style.cssFloat="left";
In DOM, there are no float property but cssFloat. I also read that IE an CHROME "understand" the property .float too but FIREFOX does not, and this property .cssFloat works in all browsers.
Under IE6 you must use this:
tile.style.styleFloat=’left’;
Happy Coding :)