@katasovaauthorNov 22.2005 — #thx a lot it worked fine but i have this problem... I use several scripts to give full functionality to the page, if i dont put ur script at the very end of all my scripts it dont work...
this is what i mean:
this works fine... [CODE] <script language="JavaScript" type="text/javascript" src="misIncludes/Menus/menu_scr.js"></script>
<script type="text/javascript"> //set below the div's size [for800x600,for1024x768] var w=[450,625]; var h=[0,450]; onload=function(){ var rezW=window.screen.width; var obj = document.getElementById('mydiv'); obj.style.width=(rezW<1024)?w[0]:w[1]; obj.style.height=(rezW<1024)?h[0]:h[1]; } </script>
[/CODE]
this wont work...
[CODE] <script type="text/javascript"> //set below the div's size [for800x600,for1024x768] var w=[450,625]; var h=[0,450]; onload=function(){ var rezW=window.screen.width; var obj = document.getElementById('mydiv'); obj.style.width=(rezW<1024)?w[0]:w[1]; obj.style.height=(rezW<1024)?h[0]:h[1]; } </script>
@ctozNov 23.2005 — #you could try a different route: after any css in the head section use js to call a stylesheet specifically for 800x 600 ( or whatever):
<script type="text/javascript">
if (screen.height<768) {document.write('<link rel="stylesheet" type="text/css" href="small.css">') }
@KorNov 23.2005 — # do u know why is this happening? [/quote] I guess that your menu_scr.js uses [B]onload[/B] event as well. But in a page there must be a single [B]onload[/B] event, so you may try this:
Write the resize code into a function [code=php] <script type="text/javascript"> function resizeDiv(){ var w=[450,625]; var h=[0,450]; var rezW=window.screen.width; var obj = document.getElementById('mydiv'); obj.style.width=(rezW<1024)?w[0]:w[1]; obj.style.height=(rezW<1024)?h[0]:h[1];
} </script> [/code]
then search in menu_scr.js where the onload event trigger the start function. There must be something like
onload = somefunction
or
window.onload = somefunction
Now re-write that line as below:
onload = function(){
somefunction();
resizeDiv()
}
It might be possible the onload to be placed in body. In this case simply add your function