[thelist] floating with javascript

liorean liorean at f2o.org
Sun Apr 25 09:41:29 CDT 2004


Douglas Livingstone wrote:
> Hi all.
> 
> I want to float a div using javascript. (as in the CSS: float: right; ) 
> I found the code to do this in IE over at MSDN:
> 
>     this.parentNode.style.styleFloat = 'right';
> 
> Works like a charm. Where can I look this sort of stuff up for 
> Moz/Opera/Safari?
> 
> I'd like to set other CSS properties like clear, padding, margins and so 
> on.

Then you should look in the DOM2CSS specification, since moz, op and saf 
follows it. 
<http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSS2Properties>
The properties that you can't find in there usually convert according to 
the following pattern:


CSS: text-align, -moz-opacity, float (JavaScript reserved keyword)
JavaScript: textAlign, MozOpacity, cssFloat

Those that are in conflict with a JavaScript reserved keywords are 
treated as if their name was not "property" but "css-property", in the 
same way that HTML attributes that are JavaScript reserved keywords are 
treated. (e.g. for --> htmlFor)

-- 
David "liorean" Andersson

ViewStyles, ViewScripts, SwitchStyles and GraphicsInfo bookmarklets:
<http://liorean.web-graphics.com/>
Hangouts:
<http://codingforums.com/> <http://yourmusicforums.com/>


More information about the thelist mailing list