Log in

View Full Version : Thumbnailer Viewer II - Add Pop Up ?



Cody J
02-05-2009, 11:37 PM
1) Script Title: Thumbnail Viewer II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm

3) Describe problem: I would like to know how to get the larger thumbnail that appears and rotates to pop up in a seperate window via javascript so it can be resized with no scrollbars, etc. I tried fiddling with this part of the script:

imageHTML='<a href="'+dest+'" target="_blank" return false>'+imageHTML+'</a>'

Target _blank and _new will open a new window, if I do anything on the lines of onClick or javascript:open.window I find myself getting errors and the whole script stalling. Thanks in advance for any help!

http://209.85.173.132/search?q=cache:hLcYlVnS9u4J:www.dynamicdrive.com/forums/archive/index.php/t-30512.html+thumbnailviewer+popup+ivan&hl=en&ct=clnk&cd=2&gl=us

This is a thread that I believe was trying to go the same direction and he said he got his working, but I don't see anything in the script involving a popup window at all.. just a note. D:

jscheuer1
02-06-2009, 04:58 AM
If you want to insert an onclick event in there, you must respect proper syntax in escaping delimiters. Take for example (the original line):


imageHTML='<a href="'+dest+'">'+imageHTML+'</a>'

The delimiters are the red single quotes ('). They show where a string begins or ends. Now if you were to put in an onclick event that requires single quotes, they would have to be escaped with a slash (\) so that the script interpreter knows that the string hasn't ended:


imageHTML='<a href="'+dest+'" onclick="alert(\'Hey!\');">'+imageHTML+'</a>'

But, with complex code, this can get quite confusing to the human eye. Fortunately, a window.open command doesn't need that many single quote delimiters if written in a way that takes advantage of the link element's properties, ex:


imageHTML='<a href="'+dest+'" target="_blank" onclick="window.open(this.href, this.target, \'width=250, height=200, top=100, left=150\'); return false;">'+imageHTML+'</a>'

Cody J
02-06-2009, 05:47 PM
Thank you ! :D