View Full Version : Help with script off JavaScriptKit.com

02-09-2004, 02:43 PM
Hello, I'm new here and I don't know whether this is the right place to post this, but I couldn't find anyplace else it would fit...

I have several thumbnails on my site, and by clicking on them I want each of them to open up the full-sized picture in a popup window - therefore I copied the script that generates a popup window off javascriptkit.com (http://www.javascriptkit.com/popwin/index.shtml).

The problem is, only the last thumbnail loads the correct page into a popup window. In fact, each of the thumbnails opens the same page that I want to be loaded by clicking on the last of them, so only the very last link seems to work...

I hope you understand what I mean, please forgive my English...

Is there a script that runs without these errors or is there any way I can correct the existing script?

Thank you very much in advance,

02-09-2004, 03:24 PM
Help if you poated the code that you modified

02-09-2004, 04:35 PM

function openpopup(){
var popurl="url.html"


<a href="javascript:openpopup()">
<img src="thumbnail.png" width="500" height="440" alt="click to enlarge" border="0"></a>


The code was generated for me at javascriptkit.com. I simply replaced the text link with a thumbnail and changed the url of the page to be loaded into the window.

I checked every page and their links, but which ever thumbnail I click on, always the page that the last thumbnail links to will be shown.

Willy Duitt
02-09-2004, 05:18 PM
Try this:

<script type="text/javascript">
function openpopup(url){

<a href="LARGE_IMAGE.png" onclick="openpopup(this.href);return false">
<img src="thumbnail.png" width="500" height="440" alt="click to enlarge" border="0"></a>


02-09-2004, 06:38 PM
Thanks so much, it absolutely works the way I want it to.
Thanks for your quick reply! :thumbsup:

By the way, is there a way of making the popup window open in the center of the screen? :rolleyes:

Willy Duitt
02-09-2004, 07:04 PM
If you want the absolute center for various screen resolutions you will need to search the net for one of the hundreds of pre-written scripts which does this. The below will center it good enough for 768X1024.