Jump to content

Recommended Posts

 

Hi Everyone,

I ran some code that I wrote about 11/2 years ago (it ran fine at the time) and now It will not run. I did a little research and found out that the code I used, which I found online and modified, is actually DreamWeaver generated code (no wonder that it stopped working). The code displays a thumbnail image, and if a photo has been uploaded and a user clicks on the thumbnail, a new window opens up and displays a larger image.

 

I like the structure of this code because it allows for cases where no image was uploaded. The thumbnail image is then a default “No Photo” gif and if a user clicks on the image anyway, a large “No Photo” gif is displayed.

 

The original code now throws and error, "JavaScript Error: Javascript:MM_openBrWindow is not defined". I made a number of attempts to get rid of the MM_openBrWindow and all failed to even allow the page the code resides on to load. The last attempt allows the page to load and when I place the cursor over the thumbnail, I can see the correct file location in the status bar. But when I click on the image, the new window does not open and I'm redirected to the "Error 404 Object Not Found!" page. I'm not sure why this is happening, it seems as if the browser knows the location of the file.

 

Here's the code:

//PHP code, DB Connection & SQL queries here

// fetch the data for this record
$row_rsproducts = mysql_fetch_assoc($rsproducts);

// Original HTML code w/ embeded PHP - which does not run any longer
<td width="132"><?php $image = 'uploads/'.$row_rsproducts['instance_id'].'a.jpg'; if (file_exists($image))    { $link = 'Javascript:MM_openBrWindow(\''.$image.'\',\'\',\'width=600,height=450\');'; } else { $link = 'Javascript:void(0)'; $image = 'images/no_Photo_Lg.gif'; } ?>
      <a href="<?php echo $link; ?>"><img src="<?php echo $image; ?>" width="132" height="99" border="0"/></a></td>

 This throws an error "JavaScript Error: Javascript:MM_openBrWindow is not defined" And the new code is:

//PHP code, DB Connection & SQL queries here

// fetch the data for this record
$row_rsproducts = mysql_fetch_assoc($rsproducts);

// New HTML code w/ embeded PHP (no MM_openBrWindow call)
<td width="132"><?php $image = 'uploads/'.$row_rsproducts['instance_id'].'a.jpg'; if (file_exists($image))    { $link = 'onclick=window.open(\''.$image.'\');'; } else { $link = 'Javascript:void(0)'; $image = 'images/no_Photo_Lg.gif'; } ?>
      <a href="<?php echo $link; ?>"><img src="<?php echo $image; ?>" width="132" height="99" border="0"/></a></td>

If anyone has an idea as to why this won't run, I'd love to hear it - and thank you in advance!

Cheers,

Rick

Link to comment
https://forums.phpfreaks.com/topic/279977-openbrwindow-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.