Click to See Complete Forum and Search --> : screen availWidth and Height


Ice3T
03-30-2003, 10:56 AM
Could someone tell me why:

<script language="javascript">
<!--
document.write(screen.availHeight+"<br>");
document.write(screen.availWidth);
-->
</script>

Will write the correct avail screen height and width but:
window.open('','','width=screen.availWidth,height=screen.availHeight')
will not open a window of those dimentions.
???

pyro
03-30-2003, 12:52 PM
You need to do it like this:

window.open('','','width='+screen.availWidth+',height='+screen.availHeight+'');

Ice3T
03-30-2003, 01:00 PM
Grrreat
Thankx alot. It works fine.

Ice3T
03-30-2003, 01:10 PM
Could you explain what the extra +'s and single quotes mean and do and how I could substract 2px from it for example.

Thankx

pyro
03-30-2003, 01:22 PM
The extra quotation marks, and the +'s are needed to escape out of the original single quotes that you have to define the window width and height. The reason for this is because once you are inside the quotes, the script will ignore any code that you might put in there.

Check this out, to subtract 2px:

<script language="javascript" type="text/javascript">

w = screen.availWidth-2;
h = screen.availHeight-2;

window.open('','','width='+w+',height='+h+'')
</script>

Ice3T
03-30-2003, 02:27 PM
Perfect!
thanks again.