I have a javascript function in my library that allows another larger window to be opened when a user clicks on a thumbnail image. The function is as follows:
Code: Select all
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}Code: Select all
<TD>
<a href="'uploads/'.$row_products['product_id'].'a.jpg'" onClick="MM_openBrWindow('<?php echo
'uploads/'.$row_products['product_id'].'a.jpg' ?>','','width=600,height=450'); return false"> <?php
if (file_exists('uploads/'.$row_products['product_id'].'a.jpg')) { ?>
<img src="<?php echo 'uploads/'.$row_products['product_id'].'a.jpg'; ?>" width="132" height="99" border="0"><?php ;
} else { ?>
<img src="<?php echo 'images/no_photo.gif'; ?>" width="132" height="99" border="0"><?php ;
} ?>
</TD>Code: Select all
<TD>
<a href="'uploads/'.$row_products['product_id'].'a.jpg'" onClick= <?php
if (file_exists('uploads/'.$row_products['product_id'].'a.jpg')) {
?> "MM_openBrWindow('<?php echo 'uploads/'.$row_products['product_id'].'a.jpg'; ?>', '', width=600,height=450'); return false"> <?php ;
} else {
?> <a href="javascript:void(0);"> <?PHP // WANT TO HAVE "NO LINK" WHEN THERE IS NO PHOTO FOR THE ITEM
}
if (file_exists('uploads/'.$row_products['product_id'].'a.jpg')) {
?><img src="<?php echo 'uploads/'.$row_products['product_id'].'a.jpg'; ?>" width="132" height="99" border="0"><?php ;
} else {
?><img src="<?php echo 'images/no_photo.gif'; ?>" width="132" height="99" border="0"><?php ;
} ?>
</a>
</TD>What happens is that when I place the cursor over the thumbnail or the No Photo image, I can see the ...uploads/'.$row_products['product_id'].'a.jpg in the component bar (which is normal), but clicking on either type of thumbnail (real or No Photo), does not open another window. Instead, the user lands on a page displaying an Object Not Found error message in the existing window. The address bar then displays something such as http://www.siteName/uploads/'.$row_products['product_id'].'a.jpg - not the resolved address. It is as if the dynamic product_id is not passed along.
This confuses me, I don't know why the product_id would not be passed, or is the problem something else entirely? Is the function unable to handle the if statement in the call to MM_openBrWindow? If someone could give me an idea of what the problem is, I'd really appreciate it!
Cheers,
Rick