A frequently asked question is: "How can I size the browser window to 800 x 600 when users visit my site?" - like in this demo or this.
To autosize the window, put this code in the Head of the page you want to size:
<script language="JavaScript">
var myW = 800; var myH = 600;
Xpos = (screen.width) ? (screen.width-myW)/2 : 0; Ypos = (screen.height) ? (screen.height-myH)/2 : 0;
self.resizeTo(myW,myH); self.moveTo(Xpos,Ypos);
</script>
|
Change the dimensions (myW and myH) to suit yourself.
Warning This might annoy some people. It could be a good idea to give them the choice to size their browser or not. You may want to add a link to allow them to do so. To do this, you'd turn the above script into a function and call it with a link.
To make your window user sizeable, put this in the Head:
<script language="JavaScript">
function sizeWindow() {
var myW = 800; var myH = 600;
Xpos = (screen.width) ? (screen.width-myW)/2 : 0; Ypos = (screen.height) ? (screen.height-myH)/2 : 0;
self.resizeTo(myW,myH); self.moveTo(Xpos,Ypos);
}
</script>
|
Then call it with a Javascript link:
See demo.
That's it.
_______________________________________ This page was written, and is maintained, by Dallas
|