473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Secondary window won't resize

From one of the online Javascript tutorials, I learned how to
open a new window and set its size. I'm building a page that has
several small photographs, and I want to let the viewer examine
either a full size image or an image with supporting detail.
It's the same idea used on lots of Web sites that show thumbnails
where you click on one and the full-size image is displayed in a
new window. However, I have different-sized images that will appear
in the new window, and I want it to resize automatically to
accommodate each new image. I don't know how to do that. The page
in question is at

http://cpacker.org/misc/petersquare

What happens with this page is that the new window has the
dimensions of the first image first clicked on. Click on another and
the new image appears in the window, but the window retains the dimensions
of the first image.

Also, "resizable=no" didn't work for me -- I could still drag on
the lower right corner of the new window and resize it manually.
I assume that's what the option is supposed to control.

Oddly enough, when I bundled the Javascript statements in a <SCRIPT...</SCRIPT>
bracket above the </HEAD> in the manner of some Web sites, the new window
retained the height of the first image, but was always about 100 pixels wide.

I browsed this newsgroup and there are a lot of threads about this issue.
learned about window.resizeTo, but that didn't work. For example,
I tried
function A1() { window.resizeTo(865,795); window.open('stpeters.jpg'...
but still got the tall skinny window I mentioned above.
Any help would be appreciated.
Jul 20 '05 #1
2 1817
DU
Charles Packer wrote:
From one of the online Javascript tutorials, I learned how to
open a new window and set its size. I'm building a page that has
several small photographs, and I want to let the viewer examine
either a full size image or an image with supporting detail.
It's the same idea used on lots of Web sites that show thumbnails
where you click on one and the full-size image is displayed in a
new window. However, I have different-sized images that will appear
in the new window, and I want it to resize automatically to
accommodate each new image. I don't know how to do that. The page
in question is at

http://cpacker.org/misc/petersquare

What happens with this page is that the new window has the
dimensions of the first image first clicked on. Click on another and
the new image appears in the window, but the window retains the dimensions
of the first image.
So your code needs to store the url of the ith image so that if an jth
image is clicked, then the jth image dimensions will be passed as
parameters in the window.open call.

Also, "resizable=no" didn't work for me -- I could still drag on
the lower right corner of the new window and resize it manually.
Which browser does that? Anyway, for the sake of usability and
accessibility to content, windows should *always* be resizable.
I assume that's what the option is supposed to control.

Oddly enough, when I bundled the Javascript statements in a <SCRIPT...</SCRIPT>
bracket above the </HEAD> in the manner of some Web sites, the new window
retained the height of the first image, but was always about 100 pixels wide.

As soon as there is a parsing problem in the windowFeatures string,
browsers stop processing that string and renders a secondary window with
default values (or persistent data).

window.open('stpeters.jpg', ' ','width-865,height=795,resizable=no'
is in your page's code.
width-865 will cause parsing problem. Browsers will try to see if
"width-865,height" is actually a valid windowFeature.
I browsed this newsgroup and there are a lot of threads about this issue.
learned about window.resizeTo, but that didn't work. For example,
I tried
function A1() { window.resizeTo(865,795); window.open('stpeters.jpg'...
but still got the tall skinny window I mentioned above.
No. You're trying to resize the current window, not the one you want to
create (and which is not created yet). Anyway, many browsers give their
users the veto power to neutralize resizeTo() calls, so this is not
reliable nor recommendable anyway.
Any help would be appreciated.


Have a look at this page which addresses your problem:
http://www10.brinkster.com/doctorunc...Thumbnail.html

Also but more complex
Create a sub-window and dynamically DOM-insert an image
http://www10.brinkster.com/doctorunc...geInPopup.html

DU
Jul 20 '05 #2
DU <dr*******@hotWIPETHISmail.com> wrote in message news:<bs**********@news.eusc.inter.net>...
Have a look at this page which addresses your problem:
http://www10.brinkster.com/doctorunc...Thumbnail.html

Well, that page has a banner that says "This file still under
construction."
However, your followup, while not exactly an answer to three decimal
places, so to speak, did give me the strength to flail onward, and my
latest version of
http://cpacker.org/misc/petersquare
gets me the right-sized secondary image, but only after two clicks.
The extra click simply kills the previous secondary window.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Carol Lyn | last post by:
Could use your assistance with this. I have a window that opens via onclick and it is a small window with info about a site. If the user is interested in visiting that site, there is a link to...
2
by: Marc | last post by:
I am trying to create a new window from which the original page can close that new window. For some reason the following code will not work. Passing the window.open command to a variable called...
25
by: chris | last post by:
how would i resize a browser window to a specific size as the page loads, using html or javascript
6
by: David Hayes | last post by:
juglesh <juglesh@nospamRadioKDUG.com> wrote in "Re: how to maximize the browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12 AM): > > >I want to maximize the browser...
3
by: Kamyk | last post by:
Hello all! I would like to open a new window with a picture after clicking on a shrinked picture which is located on the main page. I want this new window to be exactly sized as original...
7
by: Dr J R Stockton | last post by:
I want page <URL:http://www.merlyn.demon.co.uk/js-quick.htmto open, in IE6, IE7, Firefox 2, and wherever else practicable, with the control labelled F.X0 fully visible at the top of the window and...
2
by: Kevin Audleman | last post by:
I'm building a site that has images of flowers, and when someone clicks on a thumbnail it brings up a larger version in a popup window. I am using window.open to open the new window with all the...
2
Logan1337
by: Logan1337 | last post by:
Hi. This is an odd question because I'm not sure if it's a bug or if this is how it is supposed to behave, however what is happening is I have a main window of my application that is passed to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.