Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PopUp window problem

0 views
Skip to first unread message

point

unread,
May 27, 2003, 1:42:29 PM5/27/03
to
Hello there....

I have the following code for popup window written in javascript :

<SCRIPT type="text/javascript">
function popUp(URL, WID, HIG)
{
window.open(URL, "picture",
'toolbar=0,scrollbars=,location=0,statusbar=0,menubar=0,resizable=0,width=WI
D,height=HIG,top=0,left=0');
}
</SCRIPT>

-------------php---code------
<?php
.....
$pic_property = getimagesize($PicPath);
$width=&$pic_property[0];
$height=&$pic_property[1];
.......
<img src="$PicPath" border="0" onClick="popUp('$PicPath', '$width',
'$height')"></img>
.....
?>

The problem is that when I click on the picture pic is displayed but in
large window (maximum size)

I just can't get it to open using picture's width and height???

Any suggestions???

respect

point

Geoff Berrow

unread,
May 27, 2003, 6:07:19 PM5/27/03
to
Message-ID: <bb087...@enews2.newsguy.com> from point contained the
following:

> window.open(URL, "picture",
>'toolbar=0,scrollbars=,location=0,statusbar=0,menubar=0,resizable=0,width=WI
>D,height=HIG,top=0,left=0');

Not perfect but better..

window.open(URL,'picture','width=' + WID +', height=' + HIG +',
location=no, menubar=no, status=no, toolbar=no, scrollbars=no,
resizable=no');

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

Keith Maika

unread,
May 27, 2003, 12:11:40 PM5/27/03
to
This is more of a javascript question, but here's an answer.

If the window isn't open to begin with, then the JS code you have should
open it to the correct width and height for the picture (whatever you
passed in anyway)

If the window is already open though, opening it again will *NOT* resize
the window. You will need to do that on it's own using
win.resizeTo(width, height)

<SCRIPT type="text/javascript">
function popUp(URL, WID, HIG)
{

var win=window.open(URL, "picture",
'toolbar=0,scrollbars=,location=0,statusbar=0,menubar=0,resizable=0,width=WI
D,height=HIG,top=0,left=0');
win.resizeTo(WID, HIG);
}
</SCRIPT>

Also, since the width and height are numbers, you don't need to put
quotes around them when you call the function from the image (though it
shouldn't hurt any, but it may)

<img src="$PicPath" border="0" onClick="popUp('$PicPath', $width,
$height)" />

Hope that helps

--
http://kicken.mine.nu:8008/ - Personal Site
http://wiser.kicks-ass.org:8008/ - Long-term Project
Keith Maika

Keith Maika

unread,
May 27, 2003, 12:19:42 PM5/27/03
to
Keith Maika wrote:
>
> <SCRIPT type="text/javascript">
> function popUp(URL, WID, HIG)
> {
> var win=window.open(URL, "picture",
> 'toolbar=0,scrollbars=,location=0,statusbar=0,menubar=0,resizable=0,width=WI
>
> D,height=HIG,top=0,left=0');

Oops, didn't notice that slight error in the JS (though the resize
probably would have fixed it) but you need to exit the string to insert
variables into it.

var win=window.open(URL, "picture",
'toolbar=0,scrollbars=,location=0,statusbar=0,menubar=0,resizable=0,width='+
WID +',height='+ HIG +',top=0,left=0')

point

unread,
May 30, 2003, 4:48:31 PM5/30/03
to
Thanx guys....

it helped...

respect...

p.

"Geoff Berrow" <$b...@ckdog.co.uk> wrote in message
news:r1o7dvo8pnsdpuctv...@4ax.com...

0 new messages