jw_d Posted February 11, 2009 Share Posted February 11, 2009 I'd really appreciate any help someone could lend... I've tried 100 different ways to make this happen, but keeping getting screwed up. I have a script which shows small images. What I want to do is for the user to click the photo and it enlarge in a pop-up screen. The page already exist for it to pop up in (view_image.php), but I just can't get it to open that window. Here's the code: <?php $sql="select image from inputinfo where id='$id'"; $rez=mysql_query($sql,$dblnk); $row=mysql_fetch_array($rez); if($row['image']=="" && $row['image']=="") {}else{ echo "<img src='admin/{$row['image']}' width='100' height='60' border='1' />"; } ?> Here's where I tried to modify it and script stalls out (I inserted the onclick): <?php $sql="select image from inputinfo where id='$id'"; $rez=mysql_query($sql,$dblnk); $row=mysql_fetch_array($rez); if($row['image']=="" && $row['image']=="") {}else{ echo "<img src='admin/{$row['image']}' width='100' height='60' border='1' onclick="window.open('view_image.php?id=<? echo $id;?>','mywindow','menubar=1,resizable=1,width=550,height=550')" />"; } ?> Thanks SO MUCH for any help! Quote Link to comment Share on other sites More sharing options...
btherl Posted February 11, 2009 Share Posted February 11, 2009 There's a quote missing before view_image.php there. Which browser are you using? There should be javascript console somewhere that will show you what errors are found. Quote Link to comment Share on other sites More sharing options...
jw_d Posted February 11, 2009 Author Share Posted February 11, 2009 I went in there and added the quote, but the page still loads blank... I'm using IE and no js errors show. Here's what I changed it to: <?php $sql="select image from inputinfo where id='$id'"; $rez=mysql_query($sql,$dblnk); $row=mysql_fetch_array($rez); if($row['image']=="" && $row['image']=="") {}else{ echo "<img src='admin/{$row['image']}' width='100' height='60' border='1' onclick="window.open('view_image.php?id=<? echo $id;?>','mywindow','menubar=1,resizable=1,width=550,height=550')" />"; } ?> EDIT: Not sure why... the single quote ' is there before view_image but not displaying on here for some reason Quote Link to comment Share on other sites More sharing options...
btherl Posted February 11, 2009 Share Posted February 11, 2009 You're right, i can see the quote in the source of your post but not when it's displayed .. maybe a bug in phpfreaks. The code looks ok to me .. one approach you could try is finding a website that successfully pops up a window for you, and copying their code (or examining it to see how it differs from yours) Quote Link to comment Share on other sites More sharing options...
blueman378 Posted February 11, 2009 Share Posted February 11, 2009 may i suggest lightbox its a javascript cross browser compatible thing, it doesnt open in a "new window" so it is not screwed over by popup blockers, but it appears clearly. its used successfully on many large sites and is becoming sort of a standard, but as an example heres trademe (new zealands version of ebay) they use it, click on one of the pictures to see what i mean ps this is just some random auction http://www.trademe.co.nz/Antiques-collectables/Alcohol-related/Beer-related/Other/auction-201359308.htm Quote Link to comment Share on other sites More sharing options...
gunabalans Posted February 11, 2009 Share Posted February 11, 2009 since the image is available in browser already with some size use javascript take the image from dom to chanage the css present in a layer Quote Link to comment Share on other sites More sharing options...
blueman378 Posted February 11, 2009 Share Posted February 11, 2009 since the image is available in browser already with some size use javascript take the image from dom to chanage the css present in a layer which is basically what lightbox does for you in a tidy manor 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.