[Javascript] Apply padding via javascript

Abyss - Information Info at Abyss.ws
Sat Aug 19 19:19:43 CDT 2006


Thank you for the response...I realised that after a about 4 hours of 
digging around google :)

I appreciate the response though

----- Original Message ----- 
From: "Steven Chipman" <sgchipman at gmail.com>
To: "[JavaScript List]" <javascript at latech.edu>
Sent: Sunday, August 20, 2006 8:01 AM
Subject: Re: [Javascript] Apply padding via javascript


> >
>> what would be the best out of the following 2 options?
>>
>>     document.all.MyBlock.style
>> or
>>     document.layers['MyBlock'].style
>>
>
> Neither. document.all is proprietary to Microsoft's DOM (though
> supported by Opera and invisibly supported by other browsers for
> compatibility), and document.layers only works in Netscape 4.x (and
> possibly lower versions, my memory fails.).
>
> You want to use the W3C equivalent:
>
> document.getElementById("MyBlock").style.padding = "4px";
>
> The above is supported by all modern, standards compliant browsers -
> MSIE, Opera, Firefox, Mozilla, Safari, etc.
>
> Rather than setting the padding directly, I recommend applying a class
> to the object that defines your padding:
>
> document.getElementById("MyBlock").className = "yourClass";
>
> For more information on the W3C DOM, see my recent presentation on the
> topic here:
> http://slayeroffice.com/articles/DOM
>
>
>
> steve
>
> --
> S.G. Chipman
> slayeroffice.com
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 





More information about the Javascript mailing list