[Javascript] Apply padding via javascript

Paul Novitski paul at juniperwebcraft.com
Sat Aug 19 17:56:17 CDT 2006


At 11:29 PM 8/18/2006, Abyss - Information wrote:
>Hi all
>
>If I wanted to add padding to a div tag after I found the screen 
>resolution via Javascript
>
>what would be the best out of the following 2 options?
>
>     document.all.MyBlock.style
>or
>     document.layers['MyBlock'].style


Sorry for not answering your question as stated, but I like the third option:

         var oDiv = document.getElementById("MyBlock");
         oDiv.style.padding = ...

Paul  




More information about the Javascript mailing list