themistral Posted July 10, 2008 Share Posted July 10, 2008 Hi all - I am a complete beginner when it comes to Javascript! I have a list of thumnails which when clicked, show up as a bigger version on the page. This works great and this is the code I am using: The main image where the swap is show on the webpage $text .= '<img name="large" border="1" alt="product name" width="490" height="368" src="path/to/default/image" border="1" />'; The list of thumbnails foreach ($files as $value) { $text .= '<img src="path/to/thumnail" border="0" width="70" height="53" onmousedown="document.images[\'large\'].src=\'path/to/image\'" />'; } echo $text; I now want to be able to click on the large image to open an even bigger version in a new window or tab. Can anyone point me in the right direction please ??? - I just keep finding lots of image swap stuff but nothing about changing a link as well. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 10, 2008 Share Posted July 10, 2008 add an onclick to the big image...like this: $text .= '<img name="large" border="1" alt="product name" width="490" height="368" src="path/to/default/image" onclick="window.open(this.src,\'\',\'menubar=no,width=800,height=600,toolbar=no\');" border="1" />'; ...change the 800x600 to whatever you want the size to be Quote Link to comment Share on other sites More sharing options...
themistral Posted July 10, 2008 Author Share Posted July 10, 2008 Always the simple things...!! Thanks rhodesa Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.