Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Dynamically Resize Window
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedDynamically Resize Window

 Post Reply Post Reply Page  12>
Author
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Direct Link To This Post Topic: Dynamically Resize Window
    Posted: 20 June 2003 at 3:33am

I have a web based app which has a db search facility. When activated, the search results are displayed in a new window. Things is, sometimes the window is not wide enough (I dont want scrollbars).

Is it possible in Javascript to dynamically resize the window to the required width depending upon the width of the table data displayed?

Thx

Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Direct Link To This Post Posted: 25 June 2003 at 8:44am
No. You can't access any property that will tell you the width of a table. You're better off scripting it with ASP or something.
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Direct Link To This Post Posted: 27 June 2003 at 5:42am

An idea - I'm fairly sure you can use Javascript to find the width of a <div> element - so you could enclose the output in <div>...</div> tags and work out the width of the page that way...

Blair

Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Direct Link To This Post Posted: 27 June 2003 at 7:54am

Afraid that wont work....

I dont think there is a 'width' attribute with <DIV>'s. Ok, you can set it within the tag itself, but it has no effect whatsoever and JS will tell you what you already know (ie the width that you set within the tag).

 

Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Direct Link To This Post Posted: 29 June 2003 at 7:54pm

Ok - I think this is the answer -

http://www.smpte.com.au/event.asp?pid=302

Check out their code to do it. I think that's what you're looking for, sort of... but I don't know if it's totally dynamic. I just dont' have time to sort through the code right now.

Hope it helps anyways.

Back to Top
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Direct Link To This Post Posted: 30 June 2003 at 2:40am

Looking at the code, it seems that this is not a dynamic resize. The resizeTo(810,600) is hard coded and the site is possibly using frames or css for the layout.

What I need to do is resize the window width to accomodate the entire contents with no wrapping and no horizontal scrolling. Because of the dynamic nature of the content, the document could be 400 pixels wide, 500, 510, etc.

This is starting to look to be completely impossible. Yes, you can set a table to utilize the full width of the browser (ie 100%), but I need to then be able to detect what the actual width is in pixels so that I can then issue a javascript resizeTo.

Back to Top
Bluefrog View Drop Down
Senior Member
Senior Member


Joined: 23 October 2002
Location: Korea, South
Status: Offline
Points: 1701
Direct Link To This Post Posted: 01 July 2003 at 7:57am

I guess it's time to pull out the ol' calculator...

Determine the number of characters, the font size translated into pixels, etc... then you can do it...

If you use a monospace font like Courier, the math for this is much simpler...

I.E. Nightmare on your street...

I've thought of that one before - I gave up... Fonts change across browsers too...  

 

Back to Top
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Direct Link To This Post Posted: 01 July 2003 at 8:11am

I didn't think it would be possible, but hey, no harm in asking.

You never know, there may be someone out there that has done it somehow.

Considering all the other stuff that you can do, I'm surprised that something that seems relatively simple like ascertaining the width would be a piece of cake.

Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.