I have syntax errors in this piece of code. Cant get it right in echo You can ? echo "</tr><tr> <td class='photo'><a href="'.getNormalImage($file).'" onclick='NewWindow(this.href,'name','240','500','yes');return false'> <img src="'.$file.'" width='134' height='114' onContextMenu='return false;' border='0'/></a></td>"; Code (markup):
You forgot to escape the Quotes. Since the echo is already in Quotes you need to make sure to add slashes to the quotes in html that is being echoed or else it will think the echo ended and throw an error For example if you put You need add slashes the the qoutes in the src like echo "</tr><tr><td class='photo'><a href=\"'.getNormalImage($file).'\" onclick='NewWindow(this.href,'name','240','500','yes');return false'> <img src=\"'.$file.'\" width='134' height='114' onContextMenu='return false;' border='0'/></a></td>"; PHP:
Almost right. It should actually be: echo "</tr><tr><td class='photo'><a href=\"".getNormalImage($file)."\" onclick='NewWindow(this.href,'name','240','500','yes');return false'> <img src=\"".$file."\" width='134' height='114' onContextMenu='return false;' border='0'/></a></td>"; PHP:
Anytime you use a quote inside a quote (like above) you need to add a \ before the inner quote. echo "this is just a \"example\""; The about would output: this is just a "example" I hope that helps clear things up! Regards
Thanks guys. Your codes fixed the errors but didnt open a popup The finalized version comes here: echo "</tr><tr> <td class='photo'><a href=\"".getNormalImage($file)."\" onclick=\"NewWindow(this.href,'name','800','000','yes');return false\"> <img src=\"".$file."\" width='134' height='114' border='0'/></a></td>"; Code (markup): Ty so much.
If the popup didn't appear, theres probably a error in your javascript code. Have you tested the popup <a href in plain html? Does it work then?