consafos Posted July 9, 2003 Share Posted July 9, 2003 Hello, I've been struggling with this one for quite a while.. I haven't got any closer to working out what's wrong so any ideas or suggestions would be appreciated. In my product_info.php page I have the following code to display the product image (on roughly line 100): <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> which is fine. However, when this page is displayed no image shows up. When viewing the source of the displayed product_info.php I get the following code: <script language="javascript"><!-- document.write(' <a href="javascript:popupWindow('http://www.mywebsite.com/popup_image.php?pID=35')"><img src="images/my_image.jpg" border="0" alt="My Image" title="My Image" width="100" height="91" hspace="5" vspace="5"><br>Click to enlarge</a>'); //--></script> The problem is the space that appears after document.write(' which is causing a javascript error which in turn is stopping the image from showing.. any ideas? Link to comment Share on other sites More sharing options...
consafos Posted July 10, 2003 Author Share Posted July 10, 2003 Ok, I think I've fixed the problem. After a lot of trial and error I've removed the javascript and ended up with <?php echo '<a href="javascript:popupWindow('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> which works. The next few lines after that is a <noscript> section for displaying the image for people that don't have javascript. Does this mean that anyone without javascript enabled will see the image twice? How do I disable javascript (I'm using internet explorer and opera at the moment) so I can test this? Is there a better way of doing what I've done? Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.