By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,316 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

How to make a new breser window with a specific size

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.