470,594 Members | 1,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

How to make a new breser window with a specific size

wak

Hi

I'm trying to do something like that: after clicking on a table cell,
there should open a new browser window
with size depending on size of image which is to be displayed in this
window.

My idea is:
//
<img src="something.gif" style="position: absolute; top: 0; left: 0;
visibility:
hidden;">
//
and in java script function:
//(...)
document.images[0].src="something_else.gif";
var wsize=document.images[0].width;
var hsize=document.images[0].height;
//(..)
var mywindow=window.open('','',width=wsize,height=hsiz e)
//(...)
but I can't write "width=wsize, height=hsize": it doesn't work.

I could also use a switch statement for opening new windows
for example:
case wsize 100: window.open("","",width=100,height=100),
case wsize 200: window.open("","",width=200,height=150)
and so on
but this isn't a good solution because there are many images and they vary
in sizes
very much.

Any ideas??

thx
wak


Jul 23 '05 #1
1 1051
Ivo
"wak" wrote
var wsize=document.images[0].width;
var hsize=document.images[0].height;
var mywindow=window.open('','',width=wsize,height=hsiz e)
//(...)
but I can't write "width=wsize, height=hsize": it doesn't work.


Sharp observation. Try this:
window.open('','', "width=" + wsize + ",height=" + hsize )

The variables are replaced by their respective values as the interpreter
glues the string together into one.
HTH
Ivo
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Daniele petracca | last post: by
2 posts views Thread by briansmccabe | last post: by
reply views Thread by Frnak McKenney | last post: by
7 posts views Thread by Bill H | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.