If you want to insert an onclick event in there, you must respect proper syntax in escaping delimiters. Take for example (the original line):
Code:
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:
Code:
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:
Code:
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>'
Bookmarks