Usual syntax of setting any style property of DOM element is
element.style.styleName = value;
For example,
var oDiv = document.createElement('div');
oDiv.style.width = "100px";
oDiv.style.height= "100px";
But as 'float' is a reserved keyword, we CAN'T follow the same convention.
oDiv.style.float = "right"; // wrong
Unfortunately, all browsers don't handle this exception in same way (disgusting!!). So, we have to set two properties like below
oDiv.style.cssFloat = "right"; // for standards compliant browsers
oDiv.style.styleFloat = "right"; // for IE and may be for some other browsers
for more about style you can follow this link.
17 December 2008
Set 'float' property of DOM element
Posted by আলোর ছটা at 6:06 PM
Labels: JavaScript
Subscribe to:
Post Comments (Atom)
0 Comments:
Post a Comment