Page 1 of 1

Height / Width Defined popup

Posted: July 4, 2004, 10:52 am
by Akaran_D
Anyone remember the code for this offhand? I had it written down somewhere, danged if I can find it.

I want the user to be able to click a link, have it open in a new window, but set to a size I dictate and unable to resize it.

Thanks.

Posted: July 4, 2004, 12:47 pm
by Xouqoa
<pre>
<script language="JavaScript">
function openWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
</script>

<a href="#" onClick="openWindow('whatever.htm','windowName','scrollbars=yes,width=500,height=150')">link</a>
</pre>

That should do it!

Posted: July 4, 2004, 7:37 pm
by Akaran_D
Thanks Xou!

Posted: July 5, 2004, 12:23 pm
by Akaran_D
Know of a way to make that code automatically size?
Going to be using it to take image thumbnails and have the user click on them to open up the image to its standard dimensions.. but I have many iamges of varying H and W.

That possible? :)

Posted: July 5, 2004, 12:58 pm
by archeiron
Akaran_D wrote:Know of a way to make that code automatically size?
Going to be using it to take image thumbnails and have the user click on them to open up the image to its standard dimensions.. but I have many iamges of varying H and W.

That possible? :)
It is a bit more involved...

First, for your information pop-up blockers tend to stop javascript from opening new windows, so you may want to consider not using javascript because most users won't appreciate having to turn off their blocker or going through the trouble to add your site to the exception list.

It is possible to retrieve the size of an image that has been loaded by javascript. From these dimensional you can adjust the size of a window after it has been opened. If I find some time later today, I may even write up the code for you, but don't count on it! ;)

Posted: July 5, 2004, 1:02 pm
by Akaran_D
Alright - any way to do it that does not involve using JS?