real_illusions Posted May 16, 2008 Share Posted May 16, 2008 Hi all,I've been trying (without sucess) to try and get a javascript popup to display an image. However, the tricky bit, is that i use php to generate the display of the thumbnails, and therefore the links to the bigger image size. I need to use a javascript popup as I want to include other information about that image, that is stored in a txt file.Is there any specific bit of code i need to put in the popup to display the image that the user clicked on? Link to comment Share on other sites More sharing options...
jesh Posted May 16, 2008 Share Posted May 16, 2008 The part about loading the data from the text file can either be done using AJAX, or you can write out the data using PHP to a javascript array or something.The part about showing that data in a popup could look like this: <script type="text/javascript">function show(link){ var win = window.open('','fullimage','width=400,height=400'); var output = "<html>"; output += "<body>"; output += "<p>Here is some data about an image...<p>"; // this is where you'd write your text data output += "<p>Here is the image:</p>"; output += "<img src='" + link.href + "' />"; output += "</body>"; output += "</html>"; win.document.open(); win.document.write(output); win.document.close();}</script><a href="http://w3schools.invisionzone.com/style_images/6_logo.png" onclick="show(this);return false;" target="_blank">see the image in a new window</a> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.