Forum Moderators: open
I am trying to put together a website that consists of two frames (a top one for the content and a bottom one for the menu) and I want to resize the browser window to make it narrower).
I'd like the window to be resized from as soon as the person enters the URL of the site.
From what I can glean, Javascript is what I should be using to do this.
Can anyone help me out or point me in the direction of any good sources where I can read up about this. The problem I always have with trying Java things is that I never quite know where I should be putting the bits of code to make it all work!
Thanks for reading this
Colin
You need to put javascript in script tags. They can basically go anywhere on a page, but mostly putting them in the head is standard. Resizing a window script should be placed in the head.
<script>
function resizeWindow(width,height){
if (document.layers) {
// resizeTo sets inner size, so use this instead
window.outerWidth = width;
window.outerHeight = height;
} else window.resizeTo(width,height);
}
</script>
Then you just call the function from an onload event handler in your body tag like:
<body onload="resizeWindow(800,600);">
The function all fires when the page finishes loading the elements on the page and passes the height and width you want.
I would be carefull about messing with browser sizes though. People wanted it the way they had it. I find it obtrusive and annoying. I believe you should create a window you have ownership of or pop-up and size that.