epox 0 Report post Posted July 18, 2005 (edited) how can i resize the window with javascript, and how to center an element in the browser window?thanks a lot!!! Notice from BuffaloHELP: Corrected title spelling. This is more appropriate in Programming section. Please, please make sure that you post in the right section. Edited July 18, 2005 by BuffaloHELP (see edit history) Share this post Link to post Share on other sites
Tyssen 0 Report post Posted July 18, 2005 If I went to a site and it resized my browser window without asking me, I'd leave that site immediately, so in other words, I'd think carefully about implementing something like that. Share this post Link to post Share on other sites
TimothyA 0 Report post Posted July 18, 2005 I think you want to go with fluid CSS designs instead of forcing changes on the viewer's side... or are you talking about resizing/positioning an popup ad on the viewer's side? Share this post Link to post Share on other sites
electriic ink 1 Report post Posted July 18, 2005 how can i resize the window with javascriptIf this is what you mean then no objections over here, although it may be an idea to tell the user's what you did (so they don't think they've been hacked) Here's the code to maximize the window: <script language="javascipt" type="text/javascript">self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);</script> Here's an explaination of the code: self.moveTo(0,0); - Moves the window to the top left land corner (x=0,y=0) self.resizeTo(screen.availWidth,screen.availHeight); - Tells javascript to resize the window to the available screen width and height. And yes you can adapt this code: <script language="javascript" type="text/javascript">self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight/2);</script> The above will make the window fill up the top-left quarter of the screen. <script language="javascript" type="text/javascript">self.moveTo(0,0);self.resizeTo(screen.availWidth/2,screen.availHeight/2);</script> ... And this the top half an element in the browser window? What do you mean by element? An image for example. If you do I'll get back to you on it Share this post Link to post Share on other sites
electriic ink 1 Report post Posted July 18, 2005 Sorry for double posting but I've found the answer This code will show you how to put an image (maybe a piece of flash, haven't tested it yet, into the middle of the page) <table align="center" height="100%" width="100%"><tr><td valign="middle" align="center"><img src="img.jpg" alt=""></td></tr></table> It's the best I can come up with and it works. If this isn't what you wanted please say... Share this post Link to post Share on other sites
iGuest 3 Report post Posted August 14, 2009 For a time, I stopped coding web pages (and testing browsers) to concentrate on my BA degree. I've started back up again and found using the "screen.ResizeTo" javascript "command" using screen.AvailWidth & Height, IE v8 would respond to the "moveTo" command; but, not resize to the whole window as I requested. Is this a new safeguard added like the permenant location bar which, at one time, you could turn off? Could there be another script on the page simply preventing the behavior? -reply by Jim Farrell Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 24, 2009 Expanding layoutHow Can I Resize The Web Browser?How can I create a webpage in expand. That mean fit to every browser. For this I can give div height, width in percent but, in case of image hoe it will fit in proper div in percent.-question by Vivek Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 7, 2009 browser size changedHow Can I Resize The Web Browser?Hi,Kids were on the pc last week and now when I open explorer the window fills the whole screen including the task bar! Obviously something either infiltrated the pc or they accepted a setting change. Can anyone tell me how to change it back so that when I click the maximize button on the browser it fills the screen but NOT the task bar? Thanks in advance for any help you might provide! Share this post Link to post Share on other sites