PDA

Click to See Complete Forum and Search --> : Open Image in seperate window


Ruxpin
Nov 26th, 2000, 03:55 PM
I want to have a thumbnail view of images, and then when they click on the image it opens a seperate window with the larger image in it. From examples I have seen with javascript, it can open an html page fine, but not the image directly. Can anyone help?

Danial
Nov 26th, 2000, 06:39 PM
Hi,
I dont think you can open an image directly(without any html) on a browser. That will only work if they users have selcted Internet Explorer as their defualt viewer for those image types.

You can put the larger version of the image in a html file and load that when users click on the thumbnail.

Hope this helps.

Nov 26th, 2000, 08:07 PM
Why don't you use HTML to control and images HEIGHT and WIDTH properties for a thumbnail. And you can use JavaScript to open it in new page and view it in that page with the image an original size.

Just change to fit your needs.


<SCRIPT LANGUAGE="JavaScript">
function openIMG(){
windowOpen=window.open("",'Open','toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=1,width=420,height =420');
windowOpen.document.writeln("<head><title>Image</title></head><body>");
windowOpen.document.writeln('<img src=http://www.mysite.com/mygif.gif border=1>');
windowOpen.document.writeln("</body></html>");
}
</SCRIPT>


And in the image:


<a href="javascript:openIMG();">


You can always assign openIMG(MyIMG) like so you can use it over and over again.
You basically get the idea, I hope.

Ruxpin
Nov 26th, 2000, 11:44 PM
Thanks Matthew, thats just what I was after :-)

Goingnuts
Jul 17th, 2008, 05:23 AM
Help!

I have finally figured out how to enter the script above (THANKYOU) and have got my thumbnails to open a larger image in a new window. BUT..... I have several thumbnails, (for which I have used the same script) - and they are all showing the image (in the new window) of the last thumbnail.

Are you able to explain what is meant by "openIMG(MyIMG)" in simple terms!???
This is frustrating!