javascript help

Orbit

MacMan
with javascript how do u make a browser window a certain size when you open a page?

thanks
 
Here's the code I use to generate a pop-up:
PHP:
<a href="#" onclick="window.open('popup.html','popup','toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=400');return false;">open popup</a>

The second field that just says 'popup' is the object name for the new page. Name it safely as if you were naming a variable or it will cause problems.

Also, once you get a page open, you can use this code at the beginning (but inside the body, not the head) to make it resize/reposition:

PHP:
<script language="Javascript">
<!--
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);
//-->
</script>

I used screen.avail.Width,screen.availHeight to show you how to make it a full-screen window (more or less), but you can use numbers instead like 640,480 or you can use math like screen.avail.Width/2,screen.availHeight/2 to get sizes in proportion to the user's screen.

Just experiment.
 
Back
Top