| 
 Posted by Neredbojias on 06/01/06 00:01 
To further the education of mankind, Nony Buz <noya@dwtty.com> 
vouchsafed:  
 
>>> But if there 
>>> is enought room, I want there to be a 40px margin between the 
>>> 760x420 and the top of the browser.  How do I do that without 
>>> server side code? 
>> 
>> Javascript. 
>> 
>> if (screen.width>800) document.getElementById 
>> ('workdiv').style.marginTop='40px'; 
>  
> I tried it and it does not seem to work in either Firefox or IE. 
> here is my code: 
 
> </style> 
> </head> 
> <script type=text/javascript> 
> if (screen.width>800) 
> document.getElementById('main').style.marginTop='40px'; 
> </script> 
> <body> 
>  <div id="main"> 
>  </div> 
> </body> 
> </html> 
 
Include the js _within_ the <body> container after the "main" div. 
 
Javascript should always be in either the <head> or <body> section. 
 
--  
Neredbojias 
Infinity has its limits.
 
  
Navigation:
[Reply to this message] 
 |