How can I set the browser size using Javascript?
|
demo 17 Dec 2008 08:32am I'm redesigning my website but I'm clueless when it comes to JavaScript. I'd like to have my site automatically resize the browser to let's say 800x600 when someone opens the page. How would I do that? I uploaded my site quickly (there's no images or anything but you can view the source code)... Here's a link... http://chris-garman.com/indexTest.html |
Answers
|
demo 17 Dec 2008 09:16am You don't need javascript to do this. All you need is css and a div tag that wraps around the contents in your html. Then all you need to do is set the width and height attributes in css. e.g. <html> <head> <style type="text/css"> #wrapper /* this is your div tag */ { height: 600px; width: 800px; } </style> </head> <body> <div id="wrapper"> <p>With this div tag you can set height and width to your page.</p> </div> </body> </html> You can re-size a browser window using javascript. e.g. <script> function changeScreenSize(w,h) { window.resizeTo( w,h ) } </script> In the <body> tag <body onload="changeScreenSize(800,600)"> hope this helps. |
Related
Submit Answer
You must be logged in to post an answer. Please Login or Register.
Powered by phpMyAnswers.